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
AutoSizeProperty
Identifies native automatic height sizing.
public static readonly BindableProperty AutoSizeProperty
Field Value
DocumentProperty
Identifies the shared structured document.
public static readonly BindableProperty DocumentProperty
Field Value
FontFamilyProperty
Identifies the fallback font family.
public static readonly BindableProperty FontFamilyProperty
Field Value
FontSizeProperty
Identifies the fallback font size.
public static readonly BindableProperty FontSizeProperty
Field Value
IsReadOnlyProperty
Identifies the view's read-only state.
public static readonly BindableProperty IsReadOnlyProperty
Field Value
IsSpellCheckEnabledProperty
Identifies native spell-check configuration.
public static readonly BindableProperty IsSpellCheckEnabledProperty
Field Value
IsTextPredictionEnabledProperty
Identifies native text-prediction configuration.
public static readonly BindableProperty IsTextPredictionEnabledProperty
Field Value
KeyboardProperty
Identifies native keyboard configuration.
public static readonly BindableProperty KeyboardProperty
Field Value
MaxLengthProperty
Identifies the maximum projected text length for user input.
public static readonly BindableProperty MaxLengthProperty
Field Value
PlaceholderColorProperty
Identifies the native placeholder color.
public static readonly BindableProperty PlaceholderColorProperty
Field Value
PlaceholderProperty
Identifies the native placeholder.
public static readonly BindableProperty PlaceholderProperty
Field Value
SelectionProperty
Identifies this view's typed selection, including text sets, objects, cells, and complete blocks.
public static readonly BindableProperty SelectionProperty
Field Value
TextColorProperty
Identifies the fallback text color.
public static readonly BindableProperty TextColorProperty
Field Value
Properties
AcceptsTab
Gets or sets whether the native Tab key inserts a tab.
public bool AcceptsTab { get; set; }
Property Value
AutoSize
Gets or sets native automatic height sizing.
public EditorAutoSizeOption AutoSize { get; set; }
Property Value
CanRedo
Gets whether document redo is available.
public bool CanRedo { get; }
Property Value
CanUndo
Gets whether document undo is available.
public bool CanUndo { get; }
Property Value
Commands
Gets history and native clipboard commands.
public RichEditorCommands Commands { get; }
Property Value
Composition
Gets the provisional rich composition, or null when input is committed.
public RichComposition? Composition { get; }
Property Value
Document
Gets or sets the document shared by one or more views on the same dispatcher.
public RichDocument Document { get; set; }
Property Value
FontFamily
Gets or sets a view fallback for unresolved authored fonts.
public string? FontFamily { get; set; }
Property Value
FontSize
Gets or sets a view fallback for unresolved authored font sizes.
public double? FontSize { get; set; }
Property Value
IsModified
Gets whether the document differs from its acknowledged save capture.
public bool IsModified { get; }
Property Value
IsReadOnly
Gets or sets whether this view accepts authored edits. Other views remain independently editable.
public bool IsReadOnly { get; set; }
Property Value
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
Keyboard
Gets or sets the native keyboard.
public Keyboard Keyboard { get; set; }
Property Value
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
Placeholder
Gets or sets 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
Presentation
Gets view-owned decorations and lazy widgets anchored with typed rich addresses.
public RichEditorPresentation Presentation { get; }
Property Value
Selection
Gets or sets the view's typed selection. Multiple carets use a RichTextSelectionSet.
public RichSelection Selection { get; set; }
Property Value
Session
Gets this control's owned editing session. It remains attached across native handler replacement.
public RichEditorSession Session { get; }
Property Value
TextColor
Gets or sets a view fallback for unresolved authored text colors.
public Color? TextColor { get; set; }
Property Value
TextLayout
Gets native geometry using rich text addresses and snapshot-bound captures.
public RichEditorLayout TextLayout { get; }
Property Value
TypingCharacterFormat
Gets or sets explicit character overrides for newly typed text.
public RichCharacterStyle TypingCharacterFormat { get; set; }
Property Value
Methods
AddCaretAbove()
Adds a caret on the preceding native visual line.
public bool AddCaretAbove()
Returns
AddCaretBelow()
Adds a caret on the following native visual line.
public bool AddCaretBelow()
Returns
ApplyCharacterFormat(RichCharacterStyle)
Applies explicit character properties to selected content or view-owned typing state.
public RichEditResult ApplyCharacterFormat(RichCharacterStyle format)
Parameters
formatRichCharacterStyle
Returns
CopyAsync()
Copies the typed selection as RTF with an ordinary text clipboard fallback.
public Task CopyAsync()
Returns
CutAsync()
Copies and deletes the typed selection after checking that its revision and selection remain current.
public Task CutAsync()
Returns
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
editAction<RichDocumentEdit>optionsRichEditOptionsexpectedRevisionDocumentRevision?expectedSelectionGenerationlong?
Returns
Focus()
Focuses the native editor.
public bool Focus()
Returns
MoveSelections(EditorKey, bool)
Moves all text selections through native caret geometry.
public bool MoveSelections(EditorKey direction, bool extend = false)
Parameters
Returns
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
Returns
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
PastePlainTextAsync()
Pastes the clipboard's text using current typing attributes.
public Task PastePlainTextAsync()
Returns
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
fragmentRichDocumentFragment
Returns
ReplaceSelection(string)
Replaces the typed selection or every caret using semantic paragraphs and soft breaks.
public RichEditResult ReplaceSelection(string text)
Parameters
textstring
Returns
SelectAll()
Selects every complete body block.
public void SelectAll()
ToggleBold()
Toggles bold using resolved selected formatting.
public RichEditResult ToggleBold()
Returns
ToggleItalic()
Toggles italic using resolved selected formatting.
public RichEditResult ToggleItalic()
Returns
ToggleUnderline()
Toggles single underlining using resolved selected formatting.
public RichEditResult ToggleUnderline()
Returns
TryCompleteComposition()
Requests completion of native marked input without moving focus.
public bool TryCompleteComposition()
Returns
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
ContentChanged
Occurs after authored document content and every view have synchronized.
public event EventHandler<RichDocumentChangedEventArgs>? ContentChanged
Event Type
ContextMenuOpening
Allows application commands in the native context menu.
public event EventHandler<EditorContextMenuEventArgs>? ContextMenuOpening
Event Type
DocumentChanged
Occurs when the control attaches a different document.
public event EventHandler<RichDocumentReplacedEventArgs>? DocumentChanged
Event Type
KeyDown
Occurs before built-in hardware-key handling outside composition.
public event EventHandler<EditorKeyEventArgs>? KeyDown
Event Type
LinkInvoked
Allows the application to handle an authored hyperlink activation.
public event EventHandler<RichHyperlinkInvokedEventArgs>? LinkInvoked
Event Type
ObjectInvoked
Allows the application to handle an authored inline-object activation.
public event EventHandler<RichObjectInvokedEventArgs>? ObjectInvoked
Event Type
Pasting
Allows inspection or replacement of rich clipboard content and RTF import diagnostics before paste.
public event EventHandler<RichPastingEventArgs>? Pasting
Event Type
PointerExited
Occurs when a hovering pointer leaves the editor.
public event EventHandler? PointerExited
Event Type
PointerMoved
Observes pointer movement in editor coordinates.
public event EventHandler<RichTextPointerEventArgs>? PointerMoved
Event Type
PointerPressed
Observes a pointer press in editor coordinates.
public event EventHandler<RichTextPointerEventArgs>? PointerPressed
Event Type
SelectionChanged
Occurs after the typed selection changes.
public event EventHandler? SelectionChanged