Skip to main content

IUndoManager Interface

Definition​

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

Records and replays document edits.

public interface IUndoManager

Implements: IDisposable

Remarks​

Avalonia.Controls.Documents.Undo.UndoManager is the only implementation, and the one a document creates for itself. Prefer that type where you can name it: an abstraction with a single implementation buys nothing, and Avalonia.Controls.Documents.Undo.IUndoManager.Record(Avalonia.Controls.Documents.Undo.IUndoUnit) in particular cannot be satisfied from outside this assembly.

Methods​

NameDescription
BeginUndoUnitNo summary available.
ClearDiscards the whole history.
RecordRecords a unit directly onto the undo stack.
RedoRedoes the most recently undone unit and returns it.
UndoUndoes the most recent unit and returns it.

BeginUndoUnit Method​

public Avalonia.Controls.Documents.Undo.IUndoScope BeginUndoUnit(string description, Nullable<Avalonia.Controls.Documents.Undo.SelectionSnapshot> selectionBefore)

Parameters​

description string

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

Returns​

Avalonia.Controls.Documents.Undo.IUndoScope

Clear Method​

Discards the whole history.

public void Clear()

Record Method​

Records a unit directly onto the undo stack.

public void Record(Avalonia.Controls.Documents.Undo.IUndoUnit unit)

Parameters​

unit Avalonia.Controls.Documents.Undo.IUndoUnit

The unit to record. It has to satisfy an internal contract, so a unit built outside this assembly is rejected. Group edits with Avalonia.Controls.Documents.Undo.IUndoManager.BeginUndoUnit(string,Nullable{Avalonia.Controls.Documents.Undo.SelectionSnapshot}) instead.

Redo Method​

Redoes the most recently undone unit and returns it.

public Avalonia.Controls.Documents.Undo.IUndoUnit Redo()

Returns​

Avalonia.Controls.Documents.Undo.IUndoUnit

Undo Method​

Undoes the most recent unit and returns it.

public Avalonia.Controls.Documents.Undo.IUndoUnit Undo()

Returns​

Avalonia.Controls.Documents.Undo.IUndoUnit

Properties​

NameDescription
CanRedoGets whether there is anything to redo.
CanUndoGets whether there is anything to undo.
IsEnabledGets or sets whether edits are recorded.
UndoLimitGets or sets how many units the history keeps.

CanRedo Property​

Gets whether there is anything to redo.

public bool CanRedo { get; set; }

CanUndo Property​

Gets whether there is anything to undo.

public bool CanUndo { get; set; }

IsEnabled Property​

Gets or sets whether edits are recorded.

public bool IsEnabled { get; set; }

UndoLimit Property​

Gets or sets how many units the history keeps.

public int UndoLimit { get; set; }

Events​

NameDescription
StateChangedRaised when the ability to undo or redo changes.

StateChanged Event​

Raised when the ability to undo or redo changes.

public event EventHandler StateChanged