ClassKeyValueConverter
Represents a value converter that maps values using key-value pairs stored in a ResourceDictionary. This converter allows bidirectional mapping between keys and values for data binding scenarios.
Definition
Namespace:Telerik.Maui.Controls
Assembly:Telerik.Maui.Controls.dll
Syntax:
public class KeyValueConverter : IValueConverter
Inheritance: objectKeyValueConverter
Implements:
Constructors
KeyValueConverter()
Initializes a new instance of the KeyValueConverter class.
Declaration
public KeyValueConverter()
Properties
Items
Gets the collection of key-value pairs used for conversion.
Declaration
public ResourceDictionary Items { get; }
Property Value
ResourceDictionary
A ResourceDictionary containing the key-value pairs for mapping.
Methods
Convert(object, Type, object, CultureInfo)
Converts a value to its corresponding key by searching for the value in the Items collection.
Declaration
public object Convert(object value, Type type, object parameter, CultureInfo culture)
Parameters
value
The value to convert.
type
The type of the binding target property.
parameter
The converter parameter to use.
culture
The culture to use in the converter.
Returns
The key associated with the specified value, or null if no matching value is found.
ConvertBack(object, Type, object, CultureInfo)
Converts a key back to its corresponding value by searching for the key in the Items collection.
Declaration
public object ConvertBack(object value, Type type, object parameter, CultureInfo culture)
Parameters
value
The key to convert back to a value.
type
The type to convert to.
parameter
The converter parameter to use.
culture
The culture to use in the converter.
Returns
The value associated with the specified key, or null if no matching key is found.