Table of Contents

Class NativeEditorView

Namespace
RichEdit.Maui
Assembly
RichEdit.Maui.dll

The shared native editing surface used by typed MAUI editor controls.

public class NativeEditorView : View, INotifyPropertyChanged, IVisualTreeElement, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IViewController, IVisualElementController, IElementController, IGestureController, IGestureRecognizers, IPropertyMapperView, IHotReloadableView, IReplaceableView, IView, ITransform, IElement
Inheritance
NativeEditorView
Implements
Inherited Members

Constructors

NativeEditorView()

Initializes a rich editor.

public NativeEditorView()

Fields

AcceptsTabProperty

Identifies the AcceptsTab bindable property.

public static readonly BindableProperty AcceptsTabProperty

Field Value

BindableProperty

AutoSizeProperty

Identifies the AutoSize bindable property.

public static readonly BindableProperty AutoSizeProperty

Field Value

BindableProperty

CanRedoProperty

Identifies the read-only CanRedo bindable property.

public static readonly BindableProperty CanRedoProperty

Field Value

BindableProperty

CanUndoProperty

Identifies the read-only CanUndo bindable property.

public static readonly BindableProperty CanUndoProperty

Field Value

BindableProperty

DocumentProperty

Identifies the Document bindable property.

public static readonly BindableProperty DocumentProperty

Field Value

BindableProperty

FontFamilyProperty

Identifies the FontFamily bindable property.

public static readonly BindableProperty FontFamilyProperty

Field Value

BindableProperty

FontSizeProperty

Identifies the FontSize bindable property.

public static readonly BindableProperty FontSizeProperty

Field Value

BindableProperty

IsReadOnlyProperty

Identifies the IsReadOnly bindable property.

public static readonly BindableProperty IsReadOnlyProperty

Field Value

BindableProperty

IsSpellCheckEnabledProperty

Identifies the IsSpellCheckEnabled bindable property.

public static readonly BindableProperty IsSpellCheckEnabledProperty

Field Value

BindableProperty

IsTextPredictionEnabledProperty

Identifies the IsTextPredictionEnabled bindable property.

public static readonly BindableProperty IsTextPredictionEnabledProperty

Field Value

BindableProperty

KeyboardProperty

Identifies the Keyboard bindable property.

public static readonly BindableProperty KeyboardProperty

Field Value

BindableProperty

MaxLengthProperty

Identifies the MaxLength bindable property.

public static readonly BindableProperty MaxLengthProperty

Field Value

BindableProperty

PlaceholderColorProperty

Identifies the PlaceholderColor bindable property.

public static readonly BindableProperty PlaceholderColorProperty

Field Value

BindableProperty

PlaceholderProperty

Identifies the Placeholder bindable property.

public static readonly BindableProperty PlaceholderProperty

Field Value

BindableProperty

ReturnCommandParameterProperty

Identifies the ReturnCommandParameter bindable property.

public static readonly BindableProperty ReturnCommandParameterProperty

Field Value

BindableProperty

ReturnCommandProperty

Identifies the ReturnCommand bindable property.

public static readonly BindableProperty ReturnCommandProperty

Field Value

BindableProperty

SelectedRangeProperty

Identifies the SelectedRange bindable property.

public static readonly BindableProperty SelectedRangeProperty

Field Value

BindableProperty

SelectionStateProperty

Identifies the directional SelectionState bindable property.

public static readonly BindableProperty SelectionStateProperty

Field Value

BindableProperty

SelectionsProperty

Identifies the two-way bindable Selections property.

public static readonly BindableProperty SelectionsProperty

Field Value

BindableProperty

TextColorProperty

Identifies the TextColor bindable property.

public static readonly BindableProperty TextColorProperty

Field Value

BindableProperty

Properties

AcceptsTab

Gets or sets whether a Tab key inserts a tab character.

public bool AcceptsTab { get; set; }

Property Value

bool

Adornments

Gets the source-anchored views displayed outside document content and undo/redo history.

public RichTextAdornments Adornments { get; }

Property Value

RichTextAdornments

AutoSize

Gets or sets the MAUI editor automatic-sizing behavior.

public EditorAutoSizeOption AutoSize { get; set; }

Property Value

EditorAutoSizeOption

CanRedo

Gets a value indicating whether a redo unit is available.

public bool CanRedo { get; }

Property Value

bool

CanUndo

Gets a value indicating whether an undo unit is available.

public bool CanUndo { get; }

Property Value

bool

Commands

Gets the stable MVVM command set.

public RichEditorCommands Commands { get; }

Property Value

RichEditorCommands

Composition

Gets authoritative native composition state without committing or changing marked text.

public RichTextCompositionState Composition { get; }

Property Value

RichTextCompositionState

CompositionSelection

Gets the native selection within the provisional snapshot, or null outside composition.

public TextSelectionState? CompositionSelection { get; }

Property Value

TextSelectionState?

CompositionSnapshot

Gets the provisional native composition snapshot, or null when no provisional text exists.

public RichTextDocumentSnapshot? CompositionSnapshot { get; }

Property Value

RichTextDocumentSnapshot

Remarks

The snapshot has no valid document revision and cannot authorize checked edits or decorations.

Decorations

Gets the view-owned layers for syntax colors, diagnostics, and other nonpersistent appearance.

public RichTextDecorations Decorations { get; }

Property Value

RichTextDecorations

Document

Gets or sets the stable live rich-text document. A document can be attached to one editor at a time; the document owns content history and saved-state identity.

public RichTextDocument Document { get; set; }

Property Value

RichTextDocument

Folding

Gets the explicitly controlled, view-owned collapsed source ranges.

public RichTextFolding Folding { get; }

Property Value

RichTextFolding

FontFamily

Gets or sets the inherited font-family fallback for this view.

public string? FontFamily { get; set; }

Property Value

string

FontSize

Gets or sets the inherited font-size fallback for this view.

[TypeConverter(typeof(FontSizeConverter))]
public double? FontSize { get; set; }

Property Value

double?

InputRules

Gets synchronous rules that extend native input into one atomic edit. Rich-text replacements use LF line endings.

public TextInputRules InputRules { get; }

Property Value

TextInputRules

IsReadOnly

Gets or sets whether the user can modify content.

public bool IsReadOnly { get; set; }

Property Value

bool

IsSpellCheckEnabled

Gets or sets the native spell-check override. Null uses the keyboard configuration.

public bool? IsSpellCheckEnabled { get; set; }

Property Value

bool?

IsTextPredictionEnabled

Gets or sets the native text-prediction override. Null uses the keyboard configuration.

public bool? IsTextPredictionEnabled { get; set; }

Property Value

bool?

KeyBindings

Gets the hardware-key command bindings. Mutate the collection on the editor's UI thread.

public EditorKeyBindingCollection KeyBindings { get; }

Property Value

EditorKeyBindingCollection

Keyboard

Gets or sets the native keyboard configuration.

public Keyboard Keyboard { get; set; }

Property Value

Keyboard

MaxLength

Gets or sets the maximum logical UTF-16 length, or -1 for unlimited.

public int MaxLength { get; set; }

Property Value

int

Placeholder

Gets or sets the empty-document 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

ReturnCommand

Gets or sets the command invoked by a native completion action.

public ICommand? ReturnCommand { get; set; }

Property Value

ICommand

ReturnCommandParameter

Gets or sets the parameter supplied to ReturnCommand.

public object? ReturnCommandParameter { get; set; }

Property Value

object

SelectedRange

Gets or sets the selected UTF-16 document range. Assigned values are clamped to the current document bounds.

public TextSpan SelectedRange { get; set; }

Property Value

TextSpan

Selection

Gets the stable selection and selection-format facade.

public RichTextSelection Selection { get; }

Property Value

RichTextSelection

SelectionState

Gets or sets the anchor and active UTF-16 offsets, clamped to the document.

public TextSelectionState SelectionState { get; set; }

Property Value

TextSelectionState

Selections

Gets or sets every selection. The primary selection uses the native caret and input system.

public TextSelectionSet Selections { get; set; }

Property Value

TextSelectionSet

TextColor

Gets or sets the inherited text-color fallback for this view.

public Color? TextColor { get; set; }

Property Value

Color

TextLayout

Gets visible native geometry and hit testing in this editor's coordinates.

public RichTextLayout TextLayout { get; }

Property Value

RichTextLayout

Methods

AddCaret(int, bool)

Adds a caret, optionally making it the primary native selection.

public void AddCaret(int position, bool makePrimary = true)

Parameters

position int
makePrimary bool

AddCaretAbove()

Adds a caret on the preceding native visual line, preserving the preferred horizontal coordinate.

public bool AddCaretAbove()

Returns

bool

AddCaretBelow()

Adds a caret on the following native visual line, preserving the preferred horizontal coordinate.

public bool AddCaretBelow()

Returns

bool

ClearSecondarySelections()

Retains the current primary selection and removes all secondary selections.

public void ClearSecondarySelections()

ClearUndoHistory()

Clears native and managed undo and redo history without changing content.

public void ClearUndoHistory()

CopyAsync()

Copies the selected text to the system clipboard.

public Task CopyAsync()

Returns

Task

A task that completes after the clipboard is updated.

CutAsync()

Cuts the selected text to the system clipboard.

public Task CutAsync()

Returns

Task

A task that completes after the clipboard and document are updated.

MoveSelections(EditorKey, bool, bool)

Moves every selection using native caret navigation. Supports Left, Right, Up, Down, Home, and End.

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

Parameters

direction EditorKey
extend bool
byWord bool

Returns

bool

False while composing or when native layout is unavailable.

OnHandlerChanged()

protected override void OnHandlerChanged()

OnHandlerChanging(HandlerChangingEventArgs)

protected override void OnHandlerChanging(HandlerChangingEventArgs args)

Parameters

args HandlerChangingEventArgs

OnPropertyChanged(string?)

protected override void OnPropertyChanged(string? propertyName = null)

Parameters

propertyName string

PasteAsync()

Pastes a portable fragment from the system clipboard.

public Task PasteAsync()

Returns

Task

A task that completes after paste is committed or canceled.

Redo()

Reapplies the most recently undone edit.

public void Redo()

ReplaceSelections(string)

Replaces all selections atomically and collapses each caret after its inserted text.

public bool ReplaceSelections(string text)

Parameters

text string

Returns

bool

False when the view is read-only, composition is active, or the complete edit exceeds its input limit.

ScrollIntoView(TextSpan)

Brings a document range into view without changing the selection.

public void ScrollIntoView(TextSpan range)

Parameters

range TextSpan

The bounded UTF-16 range to reveal.

SelectAll()

Selects the complete logical document.

public void SelectAll()

TryApplyEdits(DocumentRevision, IReadOnlyList<RichTextEdit>, TextSelectionState?, RichTextEditOptions)

Atomically applies original-coordinate edits if this view still accepts the captured revision.

public bool TryApplyEdits(DocumentRevision revision, IReadOnlyList<RichTextEdit> edits, TextSelectionState? selectionAfter = null, RichTextEditOptions options = default)

Parameters

revision DocumentRevision

The captured document revision.

edits IReadOnlyList<RichTextEdit>

Non-overlapping replacements. Equal-offset insertions retain caller order.

selectionAfter TextSelectionState?

An optional directional selection in the resulting normalized source.

options RichTextEditOptions

History behavior and application metadata.

Returns

bool

False for stale revisions, read-only state, composition, or an exceeded input limit.

TryCompleteComposition()

Requests completion of native composition in any view of this document without moving focus.

public bool TryCompleteComposition()

Returns

bool

True when all input is committed. False when native input must finish through the platform's own focus or IME interaction.

Undo()

Undoes the most recent edit.

public void Undo()

Events

Completed

Occurs when the native input system reports an editing completion action.

public event EventHandler? Completed

Event Type

EventHandler

CompositionChanged

Occurs when native marked text starts, changes, ends, or is cleared by document/handler replacement.

public event EventHandler<RichTextCompositionChangedEventArgs>? CompositionChanged

Event Type

EventHandler<RichTextCompositionChangedEventArgs>

ContentChanged

Occurs after an atomic content transaction is committed.

public event EventHandler<RichTextContentChangedEventArgs>? ContentChanged

Event Type

EventHandler<RichTextContentChangedEventArgs>

ContextMenuOpening

Customizes the native context or selection menu. Apple platforms require iOS or Mac Catalyst 16 or later.

public event EventHandler<EditorContextMenuEventArgs>? ContextMenuOpening

Event Type

EventHandler<EditorContextMenuEventArgs>

DocumentChanged

Occurs after a replacement document is attached and view presentation is cleared.

public event EventHandler<RichTextDocumentReplacedEventArgs>? DocumentChanged

Event Type

EventHandler<RichTextDocumentReplacedEventArgs>

EffectiveAppearanceChanged

Occurs when view or native-theme fallbacks change effective appearance.

public event EventHandler? EffectiveAppearanceChanged

Event Type

EventHandler

InlineObjectInvoked

Occurs when the user invokes an inline object.

public event EventHandler<RichTextInlineObjectInvokedEventArgs>? InlineObjectInvoked

Event Type

EventHandler<RichTextInlineObjectInvokedEventArgs>

InputRejected

Occurs after a failed input plan restores committed native content without creating history.

public event EventHandler<RichTextInputRejectedEventArgs>? InputRejected

Event Type

EventHandler<RichTextInputRejectedEventArgs>

KeyDown

Occurs before built-in hardware-key handling, except while native text composition is active.

public event EventHandler<EditorKeyEventArgs>? KeyDown

Event Type

EventHandler<EditorKeyEventArgs>

LinkInvoked

Occurs when the user invokes a hyperlink.

public event EventHandler<RichTextLinkInvokedEventArgs>? LinkInvoked

Event Type

EventHandler<RichTextLinkInvokedEventArgs>

Pasting

Occurs before a portable rich fragment is pasted.

public event EventHandler<RichTextPastingEventArgs>? Pasting

Event Type

EventHandler<RichTextPastingEventArgs>

PointerExited

Occurs when a hovering pointer exits the editor.

public event EventHandler? PointerExited

Event Type

EventHandler

PointerMoved

Observes pointer movement without suppressing native input.

public event EventHandler<RichTextPointerEventArgs>? PointerMoved

Event Type

EventHandler<RichTextPointerEventArgs>

PointerPressed

Observes a pointer press without suppressing native selection or focus behavior.

public event EventHandler<RichTextPointerEventArgs>? PointerPressed

Event Type

EventHandler<RichTextPointerEventArgs>

SelectionChanged

Occurs when the selection or caret range changes.

public event EventHandler<RichTextSelectionChangedEventArgs>? SelectionChanged

Event Type

EventHandler<RichTextSelectionChangedEventArgs>

SelectionFormatChanged

Occurs when selection formatting or typing attributes change.

public event EventHandler? SelectionFormatChanged

Event Type

EventHandler

SelectionsChanged

Occurs after the selection set changes, including secondary selections.

public event EventHandler? SelectionsChanged

Event Type

EventHandler

TextChanged

Occurs when logical text changes.

public event EventHandler<RichTextTextChangedEventArgs>? TextChanged

Event Type

EventHandler<RichTextTextChangedEventArgs>