IUndoManager Interface
Definition
Records and replays document edits.
public interface IUndoManager
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
| Name | Description |
|---|---|
| BeginUndoUnit | No summary available. |
| Clear | Discards the whole history. |
| Record | Records a unit directly onto the undo stack. |
| Redo | Redoes the most recently undone unit and returns it. |
| Undo | Undoes 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
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
Undo Method
Undoes the most recent unit and returns it.
public Avalonia.Controls.Documents.Undo.IUndoUnit Undo()
Returns
Properties
| Name | Description |
|---|---|
| CanRedo | Gets whether there is anything to redo. |
| CanUndo | Gets whether there is anything to undo. |
| IsEnabled | Gets or sets whether edits are recorded. |
| UndoLimit | Gets 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
| Name | Description |
|---|---|
| StateChanged | Raised when the ability to undo or redo changes. |
StateChanged Event
Raised when the ability to undo or redo changes.
public event EventHandler StateChanged