In This Article

ImageControlConverter Class

A value converter that converts an Avalonia.Media.IImage to an Avalonia.Controls.Image control instance, commonly used in Avalonia.Controls.MenuItem.Avalonia.Controls.MenuItem.Icon property bindings.

[Obsolete("This class has been replaced by IconControlConverter which provides similar capabilities.")]
public class ImageControlConverter : IValueConverter
Inheritance:
object object
Implements:
IValueConverter

Constructors

ImageControlConverter()

Initializes an instance of the class.

public ImageControlConverter()

See Also

Properties

Height

The target height of the image.

public double Height { get; set; }

Property Value

double:

The default value is NaN, which won't set a target height on the Avalonia.Controls.Image control that is created.

See Also

Width

The target width of the image.

public double Width { get; set; }

Property Value

double:

The default value is NaN, which won't set a target width on the Avalonia.Controls.Image control that is created.

See Also

Methods

Convert(object?, Type, object?, CultureInfo)

Converts a value.

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameter Type Description
value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

object:

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.

See Also

ConvertBack(object?, Type, object?, CultureInfo)

Converts a value.

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameter Type Description
value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

object:

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.

See Also

CreateImage(IImage)

Creates an Avalonia.Controls.Image control to display the specified Avalonia.Media.IImage source.

protected virtual Image CreateImage(IImage imageSource)
Parameter Type Description
imageSource IImage

The Avalonia.Media.IImage to examine.

Returns

Image:

The Avalonia.Controls.Image that was created.

Remarks

The default implementation of this method creates a DynamicImage instance.

See Also

Inherited Members

Extension Methods

See Also