A value converter that maps file extensions to corresponding image sources. This converter uses a dictionary of file extension and image source pairs to perform the mapping.
Definition
Namespace:Telerik.Maui.Controls.Chat
Assembly:Telerik.Maui.Controls.dll
Syntax:
public class ChatFileExtensionToImageSourceConverter : IValueConverter
Inheritance: objectChatFileExtensionToImageSourceConverter
Implements:
Constructors
public ChatFileExtensionToImageSourceConverter()
Properties
Gets the collection of dictionary items used for value conversion. Each item in the dictionary represents a mapping between a file extension and an image source.
public List<ChatFileExtensionToImageSourceConverterItem> Dictionary { get; }
Gets or sets the fallback value to use when no matching dictionary item is found. If no match is found and the fallback value is not set, the original value is returned.
public object FallbackValue { get; set; }
Methods
Converts a file extension to an image source by looking it up in the dictionary.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
The file extension value to convert (used as the lookup key).
targetTypeTypeThe type to convert to. This parameter is not used.
parameterobjectAn optional parameter. This parameter is not used.
cultureCultureInfoThe culture to use for conversion. This parameter is not used.
Returns:The corresponding ImageSource value from the dictionary if found; otherwise, the fallback value or the original value.
Converts an image source back to a file extension. This operation is not supported and will throw a NotSupportedException.
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
The value to convert back. This parameter is not used.
targetTypeTypeThe type to convert to. This parameter is not used.
parameterobjectAn optional parameter. This parameter is not used.
cultureCultureInfoThe culture to use for conversion. This parameter is not used.
Returns:Throws a NotSupportedException.
Exceptions:Always thrown because backward conversion is not supported.