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