Table of Contents

Class RichEditorSession

Namespace
RichEdit.Core
Assembly
RichEdit.Core.dll

An independent typed selection and edit origin over a shared rich document.

public sealed class RichEditorSession : IDisposable
Inheritance
RichEditorSession
Implements
Inherited Members

Properties

Composition

Gets this view's provisional composition, or null outside marked input.

public RichComposition? Composition { get; }

Property Value

RichComposition

Document

Gets the shared rich document.

public RichDocument Document { get; }

Property Value

RichDocument

IsReadOnly

Gets or sets whether this view accepts authored edits.

public bool IsReadOnly { get; set; }

Property Value

bool

RevisionTracking

Gets or sets the authorship and group for this view's edits, including committed IME input. Null disables tracking.

public RichRevisionInfo? RevisionTracking { get; set; }

Property Value

RichRevisionInfo

Selection

Gets or sets the typed selection. Cell rectangles expand to whole merged cells.

public RichSelection Selection { get; set; }

Property Value

RichSelection

SelectionGeneration

Gets the generation of this session's selection.

public long SelectionGeneration { get; }

Property Value

long

TypingCharacterFormat

Gets or sets view-owned character overrides for newly typed text. Moving the selection clears these overrides.

public RichCharacterStyle TypingCharacterFormat { get; set; }

Property Value

RichCharacterStyle

Methods

ApplyCharacterFormat(RichCharacterStyle)

Applies character overrides to selected content, or to view-owned typing state at collapsed carets.

public RichEditResult ApplyCharacterFormat(RichCharacterStyle format)

Parameters

format RichCharacterStyle

Returns

RichEditResult

BeginComposition()

Acquires the document's composition lease while keeping committed content and history unchanged.

public RichComposition BeginComposition()

Returns

RichComposition

Dispose()

Detaches this session without clearing document history.

public void Dispose()

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

Commits a checked view-originating transaction.

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

Redo()

Redoes one global document unit and restores its recorded selection in this invoking view.

public void Redo()

ReplaceSelection(RichDocumentFragment, RichEditOptions)

Pastes a rich fragment at the current typed selection or every text caret in one transaction.

public RichEditResult ReplaceSelection(RichDocumentFragment fragment, RichEditOptions options = default)

Parameters

fragment RichDocumentFragment
options RichEditOptions

Returns

RichEditResult

ReplaceSelection(string, RichEditOptions)

Replaces the current typed selection or every rich text caret in one transaction.

public RichEditResult ReplaceSelection(string text, RichEditOptions options = default)

Parameters

text string
options RichEditOptions

Returns

RichEditResult

ResolveTypingCharacterFormat()

Resolves the current caret's authored cascade and view-owned typing overrides.

public ResolvedCharacterStyle ResolveTypingCharacterFormat()

Returns

ResolvedCharacterStyle

SelectAll()

Selects every authored body block, including complete tables and lists.

public void SelectAll()

ToggleBold()

Toggles bold according to the resolved values across the typed selection.

public RichEditResult ToggleBold()

Returns

RichEditResult

ToggleItalic()

Toggles italic according to the resolved values across the typed selection.

public RichEditResult ToggleItalic()

Returns

RichEditResult

ToggleUnderline()

Toggles single underlining according to the resolved values across the typed selection.

public RichEditResult ToggleUnderline()

Returns

RichEditResult

Undo()

Undoes one global document unit and restores its recorded selection in this invoking view.

public void Undo()

Events

Changed

Occurs after authored content and every attached view's selection have synchronized.

public event EventHandler<RichDocumentChangedEventArgs>? Changed

Event Type

EventHandler<RichDocumentChangedEventArgs>

CompositionChanged

Occurs when provisional marked input starts, changes, commits, or cancels.

public event EventHandler? CompositionChanged

Event Type

EventHandler

ReadOnlyChanged

Occurs when this view's editability changes.

public event EventHandler? ReadOnlyChanged

Event Type

EventHandler

SelectionChanged

Occurs after this session's selection changes.

public event EventHandler? SelectionChanged

Event Type

EventHandler

TypingFormatChanged

Occurs when view-owned typing overrides are explicitly changed.

public event EventHandler? TypingFormatChanged

Event Type

EventHandler