Class
ChatFileExtensionToImageSourceConverter

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:

cs-api-definition
public class ChatFileExtensionToImageSourceConverter : IValueConverter

Inheritance: objectChatFileExtensionToImageSourceConverter

Implements: IValueConverter

Constructors

ChatFileExtensionToImageSourceConverter()

Declaration

cs-api-definition
public ChatFileExtensionToImageSourceConverter()

Properties

Dictionary

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.

Declaration

cs-api-definition
public List<ChatFileExtensionToImageSourceConverterItem> Dictionary { get; }

Property Value

List<ChatFileExtensionToImageSourceConverterItem>

FallbackValue

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.

Declaration

cs-api-definition
public object FallbackValue { get; set; }

Property Value

object

Methods

Convert(object, Type, object, CultureInfo)

Converts a file extension to an image source by looking it up in the dictionary.

Declaration

cs-api-definition
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

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

targetType

Type

The type to convert to. This parameter is not used.

parameter

object

An optional parameter. This parameter is not used.

culture

CultureInfo

The culture to use for conversion. This parameter is not used.

Returns

object

The corresponding ImageSource value from the dictionary if found; otherwise, the fallback value or the original value.

ConvertBack(object, Type, object, CultureInfo)

Converts an image source back to a file extension. This operation is not supported and will throw a NotSupportedException.

Declaration

cs-api-definition
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

The value to convert back. This parameter is not used.

targetType

Type

The type to convert to. This parameter is not used.

parameter

object

An optional parameter. This parameter is not used.

culture

CultureInfo

The culture to use for conversion. This parameter is not used.

Returns

object

Throws a NotSupportedException.

Exceptions

NotSupportedException

Always thrown because backward conversion is not supported.