ClassDictionaryConverter
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:
public class DictionaryConverter : IValueConverter
Inheritance: objectDictionaryConverter
Implements:
Constructors
DictionaryConverter()
Declaration
public DictionaryConverter()
Properties
Dictionary
Gets the collection of dictionary items used for value conversion.
Declaration
public List<DictionaryConverterItem> Dictionary { get; }
Property Value
FallbackValue
Gets or sets the fallback value to use when no matching dictionary item is found.
Methods
Convert(object, Type, object, CultureInfo)
Converts a value by looking it up in the dictionary.
Declaration
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
value
The value to convert (used as the lookup key).
targetType
The type to convert to.
parameter
An optional parameter (not used).
culture
The culture to use for conversion (not used).
Returns
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
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
value
The value to convert back (used as the lookup value).
targetType
The type to convert back to.
parameter
An optional parameter (not used).
culture
The culture to use for conversion (not used).
Returns
The corresponding key from the dictionary if found; otherwise, the original value.