In This Article

IconControlConverter Class

A value converter that converts a value to a Avalonia.Controls.ContentControl that uses an IconPresenter for presenting the value.

public class IconControlConverter : IValueConverter
Inheritance:
object object
Implements:
IValueConverter

Constructors

IconControlConverter()

Initializes an instance of the class.

public IconControlConverter()

Properties

AreNullValuesAllowed

Indicates if null values are allowed to be converted to a control. Set this property to true only if meaningful content is defined for null values.

public bool AreNullValuesAllowed { get; set; }

Property Value

bool:

true to allow null values to be converted to a control; otherwise, false to return null for null values. The default value is false.

Height

The target height of the icon control.

public double Height { get; set; }

Property Value

double:

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

Width

The target width of the icon control.

public double Width { get; set; }

Property Value

double:

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

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.

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.

CreateControl(object?)

Creates and returns a control to display the specified icon value source.

protected virtual Control CreateControl(object? value)
Parameter Type Description
value object

The value to examine.

Returns

Control

Remarks

The default implementation of this method creates a Avalonia.Controls.ContentControl instance with a template based on IconPresenter.

Inherited Members

Extension Methods