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
AutoSizeProperty
Identifies the AutoSize bindable property.
public static readonly BindableProperty AutoSizeProperty
Field Value
CanRedoProperty
Identifies the read-only CanRedo bindable property.
public static readonly BindableProperty CanRedoProperty
Field Value
CanUndoProperty
Identifies the read-only CanUndo bindable property.
public static readonly BindableProperty CanUndoProperty
Field Value
DocumentProperty
Identifies the Document bindable property.
public static readonly BindableProperty DocumentProperty
Field Value
FontFamilyProperty
Identifies the FontFamily bindable property.
public static readonly BindableProperty FontFamilyProperty
Field Value
FontSizeProperty
Identifies the FontSize bindable property.
public static readonly BindableProperty FontSizeProperty
Field Value
IsReadOnlyProperty
Identifies the IsReadOnly bindable property.
public static readonly BindableProperty IsReadOnlyProperty
Field Value
IsSpellCheckEnabledProperty
Identifies the IsSpellCheckEnabled bindable property.
public static readonly BindableProperty IsSpellCheckEnabledProperty
Field Value
IsTextPredictionEnabledProperty
Identifies the IsTextPredictionEnabled bindable property.
public static readonly BindableProperty IsTextPredictionEnabledProperty
Field Value
KeyboardProperty
Identifies the Keyboard bindable property.
public static readonly BindableProperty KeyboardProperty
Field Value
MaxLengthProperty
Identifies the MaxLength bindable property.
public static readonly BindableProperty MaxLengthProperty
Field Value
PlaceholderColorProperty
Identifies the PlaceholderColor bindable property.
public static readonly BindableProperty PlaceholderColorProperty
Field Value
PlaceholderProperty
Identifies the Placeholder bindable property.
public static readonly BindableProperty PlaceholderProperty
Field Value
ReturnCommandParameterProperty
Identifies the ReturnCommandParameter bindable property.
public static readonly BindableProperty ReturnCommandParameterProperty
Field Value
ReturnCommandProperty
Identifies the ReturnCommand bindable property.
public static readonly BindableProperty ReturnCommandProperty
Field Value
SelectedRangeProperty
Identifies the SelectedRange bindable property.
public static readonly BindableProperty SelectedRangeProperty
Field Value
SelectionStateProperty
Identifies the directional SelectionState bindable property.
public static readonly BindableProperty SelectionStateProperty
Field Value
SelectionsProperty
Identifies the two-way bindable Selections property.
public static readonly BindableProperty SelectionsProperty
Field Value
TextColorProperty
Identifies the TextColor bindable property.
public static readonly BindableProperty TextColorProperty
Field Value
Properties
AcceptsTab
Gets or sets whether a Tab key inserts a tab character.
public bool AcceptsTab { get; set; }
Property Value
Adornments
Gets the source-anchored views displayed outside document content and undo/redo history.
public RichTextAdornments Adornments { get; }
Property Value
AutoSize
Gets or sets the MAUI editor automatic-sizing behavior.
public EditorAutoSizeOption AutoSize { get; set; }
Property Value
CanRedo
Gets a value indicating whether a redo unit is available.
public bool CanRedo { get; }
Property Value
CanUndo
Gets a value indicating whether an undo unit is available.
public bool CanUndo { get; }
Property Value
Commands
Gets the stable MVVM command set.
public RichEditorCommands Commands { get; }
Property Value
Composition
Gets authoritative native composition state without committing or changing marked text.
public RichTextCompositionState Composition { get; }
Property Value
CompositionSelection
Gets the native selection within the provisional snapshot, or null outside composition.
public TextSelectionState? CompositionSelection { get; }
Property Value
CompositionSnapshot
Gets the provisional native composition snapshot, or null when no provisional text exists.
public RichTextDocumentSnapshot? CompositionSnapshot { get; }
Property Value
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
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
Folding
Gets the explicitly controlled, view-owned collapsed source ranges.
public RichTextFolding Folding { get; }
Property Value
FontFamily
Gets or sets the inherited font-family fallback for this view.
public string? FontFamily { get; set; }
Property Value
FontSize
Gets or sets the inherited font-size fallback for this view.
[TypeConverter(typeof(FontSizeConverter))]
public double? FontSize { get; set; }
Property Value
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
IsReadOnly
Gets or sets whether the user can modify content.
public bool IsReadOnly { get; set; }
Property Value
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
Keyboard
Gets or sets the native keyboard configuration.
public Keyboard Keyboard { get; set; }
Property Value
MaxLength
Gets or sets the maximum logical UTF-16 length, or -1 for unlimited.
public int MaxLength { get; set; }
Property Value
Placeholder
Gets or sets the empty-document placeholder text.
public string Placeholder { get; set; }
Property Value
PlaceholderColor
Gets or sets the placeholder color, or null for the native default.
public Color? PlaceholderColor { get; set; }
Property Value
ReturnCommand
Gets or sets the command invoked by a native completion action.
public ICommand? ReturnCommand { get; set; }
Property Value
ReturnCommandParameter
Gets or sets the parameter supplied to ReturnCommand.
public object? ReturnCommandParameter { get; set; }
Property Value
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
Selection
Gets the stable selection and selection-format facade.
public RichTextSelection Selection { get; }
Property Value
SelectionState
Gets or sets the anchor and active UTF-16 offsets, clamped to the document.
public TextSelectionState SelectionState { get; set; }
Property Value
Selections
Gets or sets every selection. The primary selection uses the native caret and input system.
public TextSelectionSet Selections { get; set; }
Property Value
TextColor
Gets or sets the inherited text-color fallback for this view.
public Color? TextColor { get; set; }
Property Value
TextLayout
Gets visible native geometry and hit testing in this editor's coordinates.
public RichTextLayout TextLayout { get; }
Property Value
Methods
AddCaret(int, bool)
Adds a caret, optionally making it the primary native selection.
public void AddCaret(int position, bool makePrimary = true)
Parameters
AddCaretAbove()
Adds a caret on the preceding native visual line, preserving the preferred horizontal coordinate.
public bool AddCaretAbove()
Returns
AddCaretBelow()
Adds a caret on the following native visual line, preserving the preferred horizontal coordinate.
public bool AddCaretBelow()
Returns
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
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
OnPropertyChanged(string?)
protected override void OnPropertyChanged(string? propertyName = null)
Parameters
propertyNamestring
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
textstring
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
rangeTextSpanThe 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
revisionDocumentRevisionThe captured document revision.
editsIReadOnlyList<RichTextEdit>Non-overlapping replacements. Equal-offset insertions retain caller order.
selectionAfterTextSelectionState?An optional directional selection in the resulting normalized source.
optionsRichTextEditOptionsHistory 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
CompositionChanged
Occurs when native marked text starts, changes, ends, or is cleared by document/handler replacement.
public event EventHandler<RichTextCompositionChangedEventArgs>? CompositionChanged
Event Type
ContentChanged
Occurs after an atomic content transaction is committed.
public event EventHandler<RichTextContentChangedEventArgs>? ContentChanged
Event Type
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
DocumentChanged
Occurs after a replacement document is attached and view presentation is cleared.
public event EventHandler<RichTextDocumentReplacedEventArgs>? DocumentChanged
Event Type
EffectiveAppearanceChanged
Occurs when view or native-theme fallbacks change effective appearance.
public event EventHandler? EffectiveAppearanceChanged
Event Type
InlineObjectInvoked
Occurs when the user invokes an inline object.
public event EventHandler<RichTextInlineObjectInvokedEventArgs>? InlineObjectInvoked
Event Type
InputRejected
Occurs after a failed input plan restores committed native content without creating history.
public event EventHandler<RichTextInputRejectedEventArgs>? InputRejected
Event Type
KeyDown
Occurs before built-in hardware-key handling, except while native text composition is active.
public event EventHandler<EditorKeyEventArgs>? KeyDown
Event Type
LinkInvoked
Occurs when the user invokes a hyperlink.
public event EventHandler<RichTextLinkInvokedEventArgs>? LinkInvoked
Event Type
Pasting
Occurs before a portable rich fragment is pasted.
public event EventHandler<RichTextPastingEventArgs>? Pasting
Event Type
PointerExited
Occurs when a hovering pointer exits the editor.
public event EventHandler? PointerExited
Event Type
PointerMoved
Observes pointer movement without suppressing native input.
public event EventHandler<RichTextPointerEventArgs>? PointerMoved
Event Type
PointerPressed
Observes a pointer press without suppressing native selection or focus behavior.
public event EventHandler<RichTextPointerEventArgs>? PointerPressed
Event Type
SelectionChanged
Occurs when the selection or caret range changes.
public event EventHandler<RichTextSelectionChangedEventArgs>? SelectionChanged
Event Type
SelectionFormatChanged
Occurs when selection formatting or typing attributes change.
public event EventHandler? SelectionFormatChanged
Event Type
SelectionsChanged
Occurs after the selection set changes, including secondary selections.
public event EventHandler? SelectionsChanged
Event Type
TextChanged
Occurs when logical text changes.
public event EventHandler<RichTextTextChangedEventArgs>? TextChanged