In This Article

WindowIconConverter Class

A value converter that converts a value to a Avalonia.Controls.WindowIcon that uses an IconPresenter for defining the icon bitmap. An optional Avalonia.Controls.Templates.IDataTemplate for the icon can be passed as the converter parameter, otherwise the default data template will be used.

public class WindowIconConverter : IValueConverter
Inheritance:
object object
Implements:
IValueConverter

Constructors

WindowIconConverter()

Initializes an instance of the class.

public WindowIconConverter()

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 height of the Avalonia.Controls.WindowIcon and the control used to render the icon's bitmap.

public int Height { get; set; }

Property Value

int:

The default value is 16.

Width

The width of the Avalonia.Controls.WindowIcon and the control used to render the icon's bitmap.

public int Width { get; set; }

Property Value

int:

The default value is 16.

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?, IDataTemplate?)

Creates a control to display the specified icon value source.

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

The value to examine.

dataTemplate IDataTemplate

The optional data template to be used for the value.

Returns

Control:

The control that was created.

Remarks

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

Inherited Members

Extension Methods