Skip to main content

IUndoScope Interface

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Scope returned by Avalonia.Controls.Documents.Undo.UndoManager.BeginUndoUnit(string,Nullable{Avalonia.Controls.Documents.Undo.SelectionSnapshot}). Disposing the scope commits the unit to the undo stack (or nests it inside a parent scope). Callers may attach a post-edit selection snapshot via Avalonia.Controls.Documents.Undo.IUndoScope.SetSelectionAfter(Nullable{Avalonia.Controls.Documents.Undo.SelectionSnapshot}) before disposing.

public interface IUndoScope

Implements: IDisposable

Methods​

NameDescription
SetSelectionAfterNo summary available.

SetSelectionAfter Method​

public void SetSelectionAfter(Nullable<Avalonia.Controls.Documents.Undo.SelectionSnapshot> snapshot)

Parameters​

snapshot Nullable<Avalonia.Controls.Documents.Undo.SelectionSnapshot>

Properties​

NameDescription
UnitThe unit being built (or replayed) by this scope. For empty scopes (undo disabled or replay in progress) this returns the Avalonia.Controls.Documents.Undo.EmptyUndoUnit sentinel — never — so consumers can read Avalonia.Controls.Documents.Undo.IUndoUnit.Description without a null check. The Avalonia.Controls.Documents.TextModel.DocumentChangedEventArgs.UndoUnit property, in contrast, is for scopes that did not open a real unit, preserving a distinct semantic.

Unit Property​

The unit being built (or replayed) by this scope. For empty scopes (undo disabled or replay in progress) this returns the Avalonia.Controls.Documents.Undo.EmptyUndoUnit sentinel — never — so consumers can read Avalonia.Controls.Documents.Undo.IUndoUnit.Description without a null check. The Avalonia.Controls.Documents.TextModel.DocumentChangedEventArgs.UndoUnit property, in contrast, is for scopes that did not open a real unit, preserving a distinct semantic.

public Avalonia.Controls.Documents.Undo.IUndoUnit Unit { get; set; }