Table of Contents

Class RichEditor

Namespace
RichEdit.Maui
Assembly
RichEdit.Maui.dll

A native rich editor over a structured document, typed selections, reusable styles, and shared history.

public sealed class RichEditor : ContentView, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IViewController, IVisualElementController, IElementController, IGestureController, IGestureRecognizers, IPropertyMapperView, IHotReloadableView, IReplaceableView, ILayout, ILayoutController, IVisualTreeElement, IContentView, IView, IElement, ITransform, IPadding, ICrossPlatformLayout
Inheritance
RichEditor
Implements
Inherited Members

Remarks

Persist documents and fragments with RichEdit.Core.Rtf.RtfCodec. The view owns selection, composition, and typing state.

Constructors

RichEditor()

Creates an empty document and a native editing view.

public RichEditor()

Fields

AcceptsTabProperty

Identifies whether Tab inserts text.

public static readonly BindableProperty AcceptsTabProperty

Field Value

BindableProperty

AutoSizeProperty

Identifies native automatic height sizing.

public static readonly BindableProperty AutoSizeProperty

Field Value

BindableProperty

DocumentProperty

Identifies the shared structured document.

public static readonly BindableProperty DocumentProperty

Field Value

BindableProperty

FontFamilyProperty

Identifies the fallback font family.

public static readonly BindableProperty FontFamilyProperty

Field Value

BindableProperty

FontSizeProperty

Identifies the fallback font size.

public static readonly BindableProperty FontSizeProperty

Field Value

BindableProperty

IsReadOnlyProperty

Identifies the view's read-only state.

public static readonly BindableProperty IsReadOnlyProperty

Field Value

BindableProperty

IsSpellCheckEnabledProperty

Identifies native spell-check configuration.

public static readonly BindableProperty IsSpellCheckEnabledProperty

Field Value

BindableProperty

IsTextPredictionEnabledProperty

Identifies native text-prediction configuration.

public static readonly BindableProperty IsTextPredictionEnabledProperty

Field Value

BindableProperty

KeyboardProperty

Identifies native keyboard configuration.

public static readonly BindableProperty KeyboardProperty

Field Value

BindableProperty

MaxLengthProperty

Identifies the maximum projected text length for user input.

public static readonly BindableProperty MaxLengthProperty

Field Value

BindableProperty

PlaceholderColorProperty

Identifies the native placeholder color.

public static readonly BindableProperty PlaceholderColorProperty

Field Value

BindableProperty

PlaceholderProperty

Identifies the native placeholder.

public static readonly BindableProperty PlaceholderProperty

Field Value

BindableProperty

SelectionProperty

Identifies this view's typed selection, including text sets, objects, cells, and complete blocks.

public static readonly BindableProperty SelectionProperty

Field Value

BindableProperty

TextColorProperty

Identifies the fallback text color.

public static readonly BindableProperty TextColorProperty

Field Value

BindableProperty

Properties

AcceptsTab

Gets or sets whether the native Tab key inserts a tab.

public bool AcceptsTab { get; set; }

Property Value

bool

AutoSize

Gets or sets native automatic height sizing.

public EditorAutoSizeOption AutoSize { get; set; }

Property Value

EditorAutoSizeOption

CanRedo

Gets whether document redo is available.

public bool CanRedo { get; }

Property Value

bool

CanUndo

Gets whether document undo is available.

public bool CanUndo { get; }

Property Value

bool

Commands

Gets history and native clipboard commands.

public RichEditorCommands Commands { get; }

Property Value

RichEditorCommands

Composition

Gets the provisional rich composition, or null when input is committed.

public RichComposition? Composition { get; }

Property Value

RichComposition

Document

Gets or sets the document shared by one or more views on the same dispatcher.

public RichDocument Document { get; set; }

Property Value

RichDocument

FontFamily

Gets or sets a view fallback for unresolved authored fonts.

public string? FontFamily { get; set; }

Property Value

string

FontSize

Gets or sets a view fallback for unresolved authored font sizes.

public double? FontSize { get; set; }

Property Value

double?

IsModified

Gets whether the document differs from its acknowledged save capture.

public bool IsModified { get; }

Property Value

bool

IsReadOnly

Gets or sets whether this view accepts authored edits. Other views remain independently editable.

public bool IsReadOnly { get; set; }

Property Value

bool

IsSpellCheckEnabled

Gets or sets native spell checking, or null for the platform default.

public bool? IsSpellCheckEnabled { get; set; }

Property Value

bool?

IsTextPredictionEnabled

Gets or sets native prediction, or null for the platform default.

public bool? IsTextPredictionEnabled { get; set; }

Property Value

bool?

KeyBindings

Gets hardware-key command bindings.

public EditorKeyBindingCollection KeyBindings { get; }

Property Value

EditorKeyBindingCollection

Keyboard

Gets or sets the native keyboard.

public Keyboard Keyboard { get; set; }

Property Value

Keyboard

MaxLength

Gets or sets the maximum UTF-16 length in the explicit text projection; -1 allows unlimited input.

public int MaxLength { get; set; }

Property Value

int

Placeholder

Gets or sets placeholder text.

public string Placeholder { get; set; }

Property Value

string

PlaceholderColor

Gets or sets the placeholder color, or null for the native default.

public Color? PlaceholderColor { get; set; }

Property Value

Color

Presentation

Gets view-owned decorations and lazy widgets anchored with typed rich addresses.

public RichEditorPresentation Presentation { get; }

Property Value

RichEditorPresentation

Selection

Gets or sets the view's typed selection. Multiple carets use a RichTextSelectionSet.

public RichSelection Selection { get; set; }

Property Value

RichSelection

Session

Gets this control's owned editing session. It remains attached across native handler replacement.

public RichEditorSession Session { get; }

Property Value

RichEditorSession

TextColor

Gets or sets a view fallback for unresolved authored text colors.

public Color? TextColor { get; set; }

Property Value

Color

TextLayout

Gets native geometry using rich text addresses and snapshot-bound captures.

public RichEditorLayout TextLayout { get; }

Property Value

RichEditorLayout

TypingCharacterFormat

Gets or sets explicit character overrides for newly typed text.

public RichCharacterStyle TypingCharacterFormat { get; set; }

Property Value

RichCharacterStyle

Methods

AddCaretAbove()

Adds a caret on the preceding native visual line.

public bool AddCaretAbove()

Returns

bool

AddCaretBelow()

Adds a caret on the following native visual line.

public bool AddCaretBelow()

Returns

bool

ApplyCharacterFormat(RichCharacterStyle)

Applies explicit character properties to selected content or view-owned typing state.

public RichEditResult ApplyCharacterFormat(RichCharacterStyle format)

Parameters

format RichCharacterStyle

Returns

RichEditResult

CopyAsync()

Copies the typed selection as RTF with an ordinary text clipboard fallback.

public Task CopyAsync()

Returns

Task

CutAsync()

Copies and deletes the typed selection after checking that its revision and selection remain current.

public Task CutAsync()

Returns

Task

Edit(Action<RichDocumentEdit>, RichEditOptions, DocumentRevision?, long?)

Plans a checked transaction originating in this view.

public RichEditResult Edit(Action<RichDocumentEdit> edit, RichEditOptions options = default, DocumentRevision? expectedRevision = null, long? expectedSelectionGeneration = null)

Parameters

edit Action<RichDocumentEdit>
options RichEditOptions
expectedRevision DocumentRevision?
expectedSelectionGeneration long?

Returns

RichEditResult

Focus()

Focuses the native editor.

public bool Focus()

Returns

bool

MoveSelections(EditorKey, bool)

Moves all text selections through native caret geometry.

public bool MoveSelections(EditorKey direction, bool extend = false)

Parameters

direction EditorKey
extend bool

Returns

bool

MoveToAdjacentCell(bool, bool)

Moves to the next or previous distinct table cell in row order. Forward navigation can append a row at the table end.

public bool MoveToAdjacentCell(bool forward = true, bool appendRow = true)

Parameters

forward bool
appendRow bool

Returns

bool

Remarks

Nested tables navigate within the nearest table. Navigation does not enter history; an appended row and its caret form one undo unit.

PasteAsync()

Pastes RTF or ordinary clipboard text as one checked transaction.

public Task PasteAsync()

Returns

Task

PastePlainTextAsync()

Pastes the clipboard's text using current typing attributes.

public Task PastePlainTextAsync()

Returns

Task

Redo()

Redoes a shared history unit and restores its selection in this view.

public void Redo()

ReplaceSelection(RichDocumentFragment)

Pastes rich content at the typed selection or every caret.

public RichEditResult ReplaceSelection(RichDocumentFragment fragment)

Parameters

fragment RichDocumentFragment

Returns

RichEditResult

ReplaceSelection(string)

Replaces the typed selection or every caret using semantic paragraphs and soft breaks.

public RichEditResult ReplaceSelection(string text)

Parameters

text string

Returns

RichEditResult

SelectAll()

Selects every complete body block.

public void SelectAll()

ToggleBold()

Toggles bold using resolved selected formatting.

public RichEditResult ToggleBold()

Returns

RichEditResult

ToggleItalic()

Toggles italic using resolved selected formatting.

public RichEditResult ToggleItalic()

Returns

RichEditResult

ToggleUnderline()

Toggles single underlining using resolved selected formatting.

public RichEditResult ToggleUnderline()

Returns

RichEditResult

TryCompleteComposition()

Requests completion of native marked input without moving focus.

public bool TryCompleteComposition()

Returns

bool

Undo()

Undoes a shared history unit and restores its selection in this view.

public void Undo()

Unfocus()

Removes focus from the native editor.

public void Unfocus()

Events

CompositionChanged

Occurs when provisional native input starts, updates, commits, or cancels.

public event EventHandler? CompositionChanged

Event Type

EventHandler

ContentChanged

Occurs after authored document content and every view have synchronized.

public event EventHandler<RichDocumentChangedEventArgs>? ContentChanged

Event Type

EventHandler<RichDocumentChangedEventArgs>

ContextMenuOpening

Allows application commands in the native context menu.

public event EventHandler<EditorContextMenuEventArgs>? ContextMenuOpening

Event Type

EventHandler<EditorContextMenuEventArgs>

DocumentChanged

Occurs when the control attaches a different document.

public event EventHandler<RichDocumentReplacedEventArgs>? DocumentChanged

Event Type

EventHandler<RichDocumentReplacedEventArgs>

KeyDown

Occurs before built-in hardware-key handling outside composition.

public event EventHandler<EditorKeyEventArgs>? KeyDown

Event Type

EventHandler<EditorKeyEventArgs>

LinkInvoked

Allows the application to handle an authored hyperlink activation.

public event EventHandler<RichHyperlinkInvokedEventArgs>? LinkInvoked

Event Type

EventHandler<RichHyperlinkInvokedEventArgs>

ObjectInvoked

Allows the application to handle an authored inline-object activation.

public event EventHandler<RichObjectInvokedEventArgs>? ObjectInvoked

Event Type

EventHandler<RichObjectInvokedEventArgs>

Pasting

Allows inspection or replacement of rich clipboard content and RTF import diagnostics before paste.

public event EventHandler<RichPastingEventArgs>? Pasting

Event Type

EventHandler<RichPastingEventArgs>

PointerExited

Occurs when a hovering pointer leaves the editor.

public event EventHandler? PointerExited

Event Type

EventHandler

PointerMoved

Observes pointer movement in editor coordinates.

public event EventHandler<RichTextPointerEventArgs>? PointerMoved

Event Type

EventHandler<RichTextPointerEventArgs>

PointerPressed

Observes a pointer press in editor coordinates.

public event EventHandler<RichTextPointerEventArgs>? PointerPressed

Event Type

EventHandler<RichTextPointerEventArgs>

SelectionChanged

Occurs after the typed selection changes.

public event EventHandler? SelectionChanged

Event Type

EventHandler