New to Telerik UI for .NET MAUIStart a free 30-day trial

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:

C#
public class DictionaryConverter : IValueConverter

Inheritance: objectDictionaryConverter

Implements: IValueConverter

Constructors

C#
public DictionaryConverter()

Properties

Gets the collection of dictionary items used for value conversion.

C#
public List<DictionaryConverterItem> Dictionary { get; }

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

C#
public object FallbackValue { get; set; }

Methods

Converts a value by looking it up in the dictionary.

C#
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

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

targetTypeType

The type to convert to.

parameterobject

An optional parameter (not used).

cultureCultureInfo

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.

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

C#
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

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

targetTypeType

The type to convert back to.

parameterobject

An optional parameter (not used).

cultureCultureInfo

The culture to use for conversion (not used).

Returns:

object

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