Class
DictionaryConverter

Represents an IValueConverter that converts values using a dictionary-based lookup mechanism. Maps input values to output values based on key-value pairs defined in the dictionary.

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

cs-api-definition
public class DictionaryConverter : IValueConverter

Inheritance: objectDictionaryConverter

Implements: IValueConverter

Constructors

DictionaryConverter()

Declaration

cs-api-definition
public DictionaryConverter()

Properties

Dictionary

Gets the collection of dictionary items used for value conversion.

Declaration

cs-api-definition
public List<DictionaryConverterItem> Dictionary { get; }

Property Value

List<DictionaryConverterItem>

FallbackValue

Gets or sets the fallback value to use when no matching dictionary item is found.

Declaration

cs-api-definition
public object FallbackValue { get; set; }

Property Value

object

Methods

Convert(object, Type, object, CultureInfo)

Converts a value by looking it up in the dictionary.

Declaration

cs-api-definition
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

The value to convert (used as the lookup key).

targetType

Type

The type to convert to.

parameter

object

An optional parameter (not used).

culture

CultureInfo

The culture to use for conversion (not used).

Returns

object

The corresponding value from the dictionary if found; otherwise, the fallback value or the original value.

ConvertBack(object, Type, object, CultureInfo)

Converts a value back by performing a reverse lookup in the dictionary.

Declaration

cs-api-definition
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

The value to convert back (used as the lookup value).

targetType

Type

The type to convert back to.

parameter

object

An optional parameter (not used).

culture

CultureInfo

The culture to use for conversion (not used).

Returns

object

The corresponding key from the dictionary if found; otherwise, the original value.