Table of Contents

Class RichTextAdornments

Namespace
RichEdit.Maui
Assembly
RichEdit.Maui.dll

Owns source-anchored MAUI views for one editor.

public sealed class RichTextAdornments : IReadOnlyList<RichTextAdornment>, IReadOnlyCollection<RichTextAdornment>, IEnumerable<RichTextAdornment>, IEnumerable
Inheritance
RichTextAdornments
Implements
Inherited Members

Remarks

Adding and removing views never changes document content, selection, saved state, or undo/redo history. Anchors track text edits. Replacing or deleting text containing an anchor removes it; document replacement clears all adornments. Undo does not recreate removed views. Hidden and offscreen anchors are not displayed. Views are clipped to the editor viewport. Applications own content, actions, offsets, and overlap policy. All mutations require the editor's UI thread.

Properties

Count

public int Count { get; }

Property Value

int

this[int]

public RichTextAdornment this[int index] { get; }

Parameters

index int

Property Value

RichTextAdornment

MarginWidth

Gets or sets the reserved left-margin width in device-independent units; the default is zero.

public double MarginWidth { get; set; }

Property Value

double

Methods

Add(int, View, RichTextAdornmentOptions?)

Adds an unparented view at a UTF-16 source position, including the end of the document.

public RichTextAdornment Add(int position, View view, RichTextAdornmentOptions? options = null)

Parameters

position int

The source anchor.

view View

The view to display. Its measured size determines the adornment bounds.

options RichTextAdornmentOptions

Optional placement, insertion affinity, and sizing.

Returns

RichTextAdornment

A handle that can be removed or disposed independently.

Clear()

Removes all adornments, preserving the configured margin width.

public void Clear()

CreateSource(Func<RichTextWidget, View>, Action<RichTextWidget, View>?)

Creates an independently owned source of widgets whose views are created near the viewport and recycled offscreen.

public RichTextWidgetSource CreateSource(Func<RichTextWidget, View> create, Action<RichTextWidget, View>? recycle = null)

Parameters

create Func<RichTextWidget, View>
recycle Action<RichTextWidget, View>

Returns

RichTextWidgetSource

GetEnumerator()

public IEnumerator<RichTextAdornment> GetEnumerator()

Returns

IEnumerator<RichTextAdornment>

Remove(RichTextAdornment)

Removes one adornment without affecting other owners' views.

public bool Remove(RichTextAdornment adornment)

Parameters

adornment RichTextAdornment

The handle returned by Add(int, View, RichTextAdornmentOptions?).

Returns

bool

Whether the adornment belonged to this collection.

TryAdd(DocumentRevision, int, View, out RichTextAdornment?, RichTextAdornmentOptions?)

Adds a view only when the revision still addresses the current document.

public bool TryAdd(DocumentRevision revision, int position, View view, out RichTextAdornment? adornment, RichTextAdornmentOptions? options = null)

Parameters

revision DocumentRevision

The revision used to compute the anchor.

position int

The source anchor.

view View

Unparented application content.

adornment RichTextAdornment

The new handle, or null for a stale revision.

options RichTextAdornmentOptions

Optional placement, insertion affinity, and sizing.

Returns

bool

Whether the view was attached.