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
this[int]
public RichTextAdornment this[int index] { get; }
Parameters
indexint
Property Value
MarginWidth
Gets or sets the reserved left-margin width in device-independent units; the default is zero.
public double MarginWidth { get; set; }
Property Value
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
positionintThe source anchor.
viewViewThe view to display. Its measured size determines the adornment bounds.
optionsRichTextAdornmentOptionsOptional 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
createFunc<RichTextWidget, View>recycleAction<RichTextWidget, View>
Returns
GetEnumerator()
public IEnumerator<RichTextAdornment> GetEnumerator()
Returns
Remove(RichTextAdornment)
Removes one adornment without affecting other owners' views.
public bool Remove(RichTextAdornment adornment)
Parameters
adornmentRichTextAdornmentThe 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
revisionDocumentRevisionThe revision used to compute the anchor.
positionintThe source anchor.
viewViewUnparented application content.
adornmentRichTextAdornmentThe new handle, or null for a stale revision.
optionsRichTextAdornmentOptionsOptional placement, insertion affinity, and sizing.
Returns
- bool
Whether the view was attached.