Skip to main content

RichImageSourceConverter Class

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Converts a URI string into a Avalonia.Controls.Documents.RichImageSource so a Avalonia.Controls.Documents.RichImage.Source can be authored directly in XAML — for example <RichImage Source="avares://MyApp/Assets/picture.png" />, or a path relative to the current XAML file, <RichImage Source="/Assets/picture.png" />.

public class RichImageSourceConverter

Inheritance: TypeConverter -> RichImageSourceConverter

Remarks​

A relative URI is resolved against the XAML base URI of the document being loaded, the same way Avalonia.Media.FontFamily and Avalonia's Image.Source resolve relative asset references. Local assets (avares:/resm: via the asset loader, or file: from disk) are read immediately and embedded as an Avalonia.Controls.Documents.EmbeddedImageSource, so the pixels travel with — and serialize with — the document. Remote images (http:/https:) become a Avalonia.Controls.Documents.DeferredImageSource that records the URL; the editor shows a placeholder until a loader resolves it. The MIME type is inferred from the file extension.

Constructors​

NameDescription
RichImageSourceConverterNo summary available.

RichImageSourceConverter Constructor​

public RichImageSourceConverter()

Methods​

NameDescription
CanConvertFromNo summary available.
ConvertFromNo summary available.

CanConvertFrom Method​

public bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)

Parameters​

context System.ComponentModel.ITypeDescriptorContext

sourceType Type

Returns​

bool

ConvertFrom Method​

public object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)

Parameters​

context System.ComponentModel.ITypeDescriptorContext

culture System.Globalization.CultureInfo

value object

Returns​

object