New to Telerik Document ProcessingStart a free 30-day trial

Manages undo/redo stacks for workbook modifications, tracking command execution and enabling history navigation.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.History

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public class WorkbookHistory

Inheritance: objectWorkbookHistory

Events

Raised when all history entries are removed from the undo and redo stacks.

C#
public event EventHandler Cleared

Raised after a history record is committed to the undo stack, providing the recorded action details.

C#
public event EventHandler<WorkbookHistoryRecordExecutedEventArgs> RecordExecuted

Raised before a new history record begins recording, signaling the start of an undo group.

C#
public event EventHandler RecordExecuting

Raised after a redo operation completes, providing the action that was reapplied.

C#
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuted

Raised before a redo operation begins, providing the action about to be reapplied.

C#
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuting

Raised after an undo operation completes, providing the action that was reversed.

C#
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuted

Raised before an undo operation begins, providing the action about to be reversed.

C#
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuting

Fields

The default depth of the workbook history.

C#
public const int DefaultDepth = 2147483647

Methods

Starts batching subsequent commands into a single composite action that will undo/redo together.

C#
public void BeginUndoGroup()

Aborts the current undo group and reverts all commands executed within it.

C#
public void CancelUndoGroup()

Removes all actions from both undo and redo stacks, resetting history to empty.

C#
public void Clear()

Completes the current undo group and commits the batched commands as a single history entry.

C#
public void EndUndoGroup()

Invokes the Cleared event after removing all history entries.

C#
protected virtual void OnCleared()

Invokes the RecordExecuted event after committing a history action.

C#
protected virtual void OnRecordExecuted(WorkbookHistoryAction historyAction, bool isMerged)
Parameters:historyActionWorkbookHistoryAction

The history action.

isMergedbool

This parameter is not used and is reserved for future use.

Invokes the RecordExecuting event when history recording starts.

C#
protected virtual void OnRecordExecuting()

Invokes the RedoExecuted event after completing a redo operation.

C#
protected virtual void OnRedoExecuted(WorkbookHistoryAction historyAction)
Parameters:historyActionWorkbookHistoryAction

The history action.

Invokes the RedoExecuting event before reapplying a history action.

C#
protected virtual void OnRedoExecuting(WorkbookHistoryAction historyAction)
Parameters:historyActionWorkbookHistoryAction

The history action.

Invokes the UndoExecuted event after completing an undo operation.

C#
protected virtual void OnUndoExecuted(WorkbookHistoryAction historyAction)
Parameters:historyActionWorkbookHistoryAction

The history action.

Invokes the UndoExecuting event before reversing a history action.

C#
protected virtual void OnUndoExecuting(WorkbookHistoryAction historyAction)
Parameters:historyActionWorkbookHistoryAction

The history action.

Reapplies the most recently undone action from the redo stack and returns whether the operation succeeded.

C#
public bool Redo()
Returns:

bool

The value indicating whether the redo was successfully performed.

Reverses the most recent action from the undo stack and returns whether the operation succeeded.

C#
public bool Undo()
Returns:

bool

The value indicating whether the undo was successfully performed.

Properties

Indicates whether the redo stack contains actions available to reapply.

C#
public bool CanRedo { get; }
Property Value:

The value indicating whether redo can be performed.

Indicates whether the undo stack contains actions available to reverse.

C#
public bool CanUndo { get; }
Property Value:

The value indicating whether undo can be performed.

Maximum number of actions retained in the undo stack before oldest entries are discarded.

C#
public int Depth { get; set; }
Property Value:

The depth of the history.

Controls whether commands are recorded in the undo/redo stacks; when disabled, history is cleared and recording stops.

C#
public bool IsEnabled { get; set; }
Property Value:

The value indicating whether history is enabled.

Indicates whether multiple commands are being batched into a single undoable action via BeginUndoGroup/EndUndoGroup.

C#
public bool IsInUndoGroup { get; }
Property Value:

The value indicating whether the history is currently recording an undo group.

Workbook instance whose modification history is tracked by this history manager.

C#
public Workbook Workbook { get; }
Property Value:

The workbook.