Skip to main content

RichImage Class

Definition​

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

An inline image embedded in text flow content. The image occupies a single character position (the object replacement character) and carries its content through its Avalonia.Controls.Documents.RichImage.Source, so it round-trips through snapshots, undo, and serialization.

public class RichImage

Inheritance: object -> AvaloniaObject -> Animatable -> StyledElement -> RichTextElement -> RichInline -> RichInlineUIContainer -> RichImage

Derived types:MarkdownImage

Constructors​

NameDescription
RichImage (2 overloads)Initializes a new instance of the Avalonia.Controls.Documents.RichImage class.

RichImage overloads​

RichImage Constructor​

Initializes a new instance of the Avalonia.Controls.Documents.RichImage class.

public RichImage()

RichImage Constructor​

public RichImage(ReadOnlyMemory<byte> data, string mimeType)
Parameters​

data ReadOnlyMemory<byte>

mimeType string

Methods​

NameDescription
ApplyStylingApplies styling to the control if the control is initialized and styling is not already applied. Inherited from StyledElement.
BeginInitInherited from StyledElement.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EndInitInherited from StyledElement.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
TryGetResourceInherited from StyledElement.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Properties​

NameDescription
ActualThemeVariantGets the UI theme that is currently used by the element, which might be different than the RequestedThemeVariantProperty. Inherited from StyledElement.
AltTextGets or sets the alternative text describing the image (accessibility, DOCX description). Not all serialization formats can represent it.
BackgroundGets or sets the brush used to fill the background of the control. Inherited from RichTextElement.
BaselineAlignmentGets or sets the baseline alignment. Inherited from RichInline.
ChildGets or sets the child control. Inherited from RichInlineUIContainer.
ClassesGets or sets the styled element's classes. Inherited from StyledElement.
ContentEndGets a text pointer to the end of the content in the document. Inherited from RichTextElement.
ContentLengthGets the length, in characters, that is covered by this element. Inherited from RichTextElement.
ContentRangeGets the range of text that represents the entire content, or null if the content is empty or unavailable. Inherited from RichTextElement.
ContentStartGets a text pointer to the start of the content in the document. Inherited from RichTextElement.
DataContextGets or sets the control's data context. Inherited from StyledElement.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
FirstChildElementGets the first direct child element in the document tree, or if none exists. Inherited from RichTextElement.
FontFamilyGets or sets the font family used to display text. Inherited from RichTextElement.
FontFeaturesGets or sets the collection of font features to apply to the text. Inherited from RichTextElement.
FontSizeGets or sets the size of the font used to display text. Inherited from RichTextElement.
FontStretchGets or sets the degree to which the font is stretched horizontally. Inherited from RichTextElement.
FontStyleGets or sets the font style used to display the text. Inherited from RichTextElement.
FontWeightGets or sets the weight or thickness of the font used to display text. Inherited from RichTextElement.
ForegroundGets or sets the brush used to paint the foreground of the control. Inherited from RichTextElement.
HeightGets or sets the display height in device-independent pixels. double.NaN (the default) uses the image's intrinsic pixel size.
IsAttachedToDocumentGets a value indicating whether this element is currently attached to a Avalonia.Controls.Documents.TextModel.TextDocument. Inherited from RichTextElement.
IsInitializedGets a value that indicates whether the element has finished initialization. Inherited from StyledElement.
ItemInherited from AvaloniaObject.
LastChildElementGets the last direct child element in the document tree, or if none exists. Inherited from RichTextElement.
LetterSpacingGets or sets the letter spacing. Inherited from RichTextElement.
NameGets or sets the name of the styled element. Inherited from StyledElement.
NextElementGets the next sibling element in the document tree, or if none exists. Inherited from RichTextElement.
ParentGets the styled element's logical parent. Inherited from StyledElement.
PreviousElementGets the previous sibling element in the document tree, or if none exists. Inherited from RichTextElement.
ResourcesGets or sets the styled element's resource dictionary. Inherited from StyledElement.
SourceGets or sets the image source — the single source of truth for the image's content. An Avalonia.Controls.Documents.EmbeddedImageSource carries encoded bytes in the document; a Avalonia.Controls.Documents.DeferredImageSource references an image resolved on demand (e.g. a URL). Drives both rendering and snapshot capture.
StyleKeyGets the type by which the element is styled. Inherited from StyledElement.
StylesGets the styles for the styled element. Inherited from StyledElement.
TemplatedParentGets the styled element whose lookless template this styled element is part of. Inherited from StyledElement.
TextDecorationsGets or sets the text decorations (underline, strikethrough, etc.). Inherited from RichInline.
TextDocumentGets the Avalonia.Controls.Documents.TextModel.TextDocument this element is attached to, or if not attached. Inherited from RichTextElement.
ThemeGets or sets the theme to be applied to the element. Inherited from StyledElement.
TransitionsGets or sets the property transitions for the control. Inherited from Animatable.
UnderlineStyleGets or sets the line style of the underline. Only takes effect when Avalonia.Controls.Documents.RichInline.TextDecorations carries an underline; null means unset and draws as Avalonia.Controls.Documents.TextModel.Formatting.UnderlineStyle.Single. Inherited from RichInline.
WidthGets or sets the display width in device-independent pixels. double.NaN (the default) uses the image's intrinsic pixel size.

AltText Property​

Gets or sets the alternative text describing the image (accessibility, DOCX description). Not all serialization formats can represent it.

public string AltText { get; set; }

Height Property​

Gets or sets the display height in device-independent pixels. double.NaN (the default) uses the image's intrinsic pixel size.

public double Height { get; set; }

Source Property​

Gets or sets the image source — the single source of truth for the image's content. An Avalonia.Controls.Documents.EmbeddedImageSource carries encoded bytes in the document; a Avalonia.Controls.Documents.DeferredImageSource references an image resolved on demand (e.g. a URL). Drives both rendering and snapshot capture.

public Avalonia.Controls.Documents.RichImageSource Source { get; set; }

Width Property​

Gets or sets the display width in device-independent pixels. double.NaN (the default) uses the image's intrinsic pixel size.

public double Width { get; set; }

Fields​

NameDescription
AltTextPropertyDefines the Avalonia.Controls.Documents.RichImage.AltText property.
BackgroundPropertyDefines the Avalonia.Controls.Documents.RichTextElement.Background property. Inherited from RichTextElement.
BaselineAlignmentPropertyDefines the Avalonia.Controls.Documents.RichInline.BaselineAlignment property. Inherited from RichInline.
ChildPropertyDefines the Avalonia.Controls.Documents.RichInlineUIContainer.Child property. Inherited from RichInlineUIContainer.
DataContextPropertyDefines the Avalonia.StyledElement.DataContext property. Inherited from StyledElement.
FontFamilyPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontFamily property. Inherited from RichTextElement.
FontFeaturesPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontFeatures property. Inherited from RichTextElement.
FontSizePropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontSize property. Inherited from RichTextElement.
FontStretchPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontStretch property. Inherited from RichTextElement.
FontStylePropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontStyle property. Inherited from RichTextElement.
FontWeightPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontWeight property. Inherited from RichTextElement.
ForegroundPropertyDefines the Avalonia.Controls.Documents.RichTextElement.Foreground property. Inherited from RichTextElement.
HeightPropertyDefines the Avalonia.Controls.Documents.RichImage.Height property.
LetterSpacingPropertyDefines the Avalonia.Controls.Documents.RichTextElement.LetterSpacing property. Inherited from RichTextElement.
NamePropertyDefines the Avalonia.StyledElement.Name property. Inherited from StyledElement.
ParentPropertyDefines the Avalonia.StyledElement.Parent property. Inherited from StyledElement.
SourcePropertyDefines the Avalonia.Controls.Documents.RichImage.Source property.
TemplatedParentPropertyDefines the Avalonia.StyledElement.TemplatedParent property. Inherited from StyledElement.
TextDecorationsPropertyAvaloniaProperty for Avalonia.Controls.Documents.RichInline.TextDecorations property. Inherited from RichInline.
ThemePropertyDefines the Avalonia.StyledElement.Theme property. Inherited from StyledElement.
TransitionsPropertyDefines the Avalonia.Animation.Animatable.Transitions property. Inherited from Animatable.
UnderlineStylePropertyAvaloniaProperty for Avalonia.Controls.Documents.RichInline.UnderlineStyle property. Inherited from RichInline.
WidthPropertyDefines the Avalonia.Controls.Documents.RichImage.Width property.

AltTextProperty Field​

Defines the Avalonia.Controls.Documents.RichImage.AltText property.

public Avalonia.StyledProperty<string> AltTextProperty

HeightProperty Field​

Defines the Avalonia.Controls.Documents.RichImage.Height property.

public Avalonia.StyledProperty<double> HeightProperty

SourceProperty Field​

Defines the Avalonia.Controls.Documents.RichImage.Source property.

public Avalonia.StyledProperty<Avalonia.Controls.Documents.RichImageSource> SourceProperty

WidthProperty Field​

Defines the Avalonia.Controls.Documents.RichImage.Width property.

public Avalonia.StyledProperty<double> WidthProperty

Events​

NameDescription
ActualThemeVariantChangedRaised when the theme variant is changed on the element or an ancestor of the element. Inherited from StyledElement.
AttachedToLogicalTreeRaised when the styled element is attached to a rooted logical tree. Inherited from StyledElement.
DataContextChangedOccurs when the Avalonia.StyledElement.DataContext property changes. Inherited from StyledElement.
DetachedFromLogicalTreeRaised when the styled element is detached from a rooted logical tree. Inherited from StyledElement.
InitializedOccurs when the styled element has finished initialization. Inherited from StyledElement.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.
ResourcesChangedOccurs when a resource in this styled element or a parent styled element has changed. Inherited from StyledElement.