ClassWorkbookHistory
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:
public class WorkbookHistory
Inheritance: objectWorkbookHistory
Fields
DefaultDepth
The default depth of the workbook history.
Properties
CanRedo
Indicates whether the redo stack contains actions available to reapply.
Declaration
public bool CanRedo { get; }
Property Value
The value indicating whether redo can be performed.
CanUndo
Indicates whether the undo stack contains actions available to reverse.
Declaration
public bool CanUndo { get; }
Property Value
The value indicating whether undo can be performed.
Depth
Maximum number of actions retained in the undo stack before oldest entries are discarded.
Declaration
public int Depth { get; set; }
Property Value
The depth of the history.
IsEnabled
Controls whether commands are recorded in the undo/redo stacks; when disabled, history is cleared and recording stops.
Declaration
public bool IsEnabled { get; set; }
Property Value
The value indicating whether history is enabled.
IsInUndoGroup
Indicates whether multiple commands are being batched into a single undoable action via BeginUndoGroup/EndUndoGroup.
Declaration
public bool IsInUndoGroup { get; }
Property Value
The value indicating whether the history is currently recording an undo group.
Methods
BeginUndoGroup()
Starts batching subsequent commands into a single composite action that will undo/redo together.
Declaration
public void BeginUndoGroup()
CancelUndoGroup()
Aborts the current undo group and reverts all commands executed within it.
Declaration
public void CancelUndoGroup()
Clear()
Removes all actions from both undo and redo stacks, resetting history to empty.
Declaration
public void Clear()
EndUndoGroup()
Completes the current undo group and commits the batched commands as a single history entry.
Declaration
public void EndUndoGroup()
OnCleared()
Invokes the Cleared event after removing all history entries.
Declaration
protected virtual void OnCleared()
OnRecordExecuted(WorkbookHistoryAction, bool)
Invokes the RecordExecuted event after committing a history action.
Declaration
protected virtual void OnRecordExecuted(WorkbookHistoryAction historyAction, bool isMerged)
Parameters
historyAction
The history action.
isMerged
This parameter is not used and is reserved for future use.
OnRecordExecuting()
Invokes the RecordExecuting event when history recording starts.
Declaration
protected virtual void OnRecordExecuting()
OnRedoExecuted(WorkbookHistoryAction)
Invokes the RedoExecuted event after completing a redo operation.
Declaration
protected virtual void OnRedoExecuted(WorkbookHistoryAction historyAction)
Parameters
historyAction
The history action.
OnRedoExecuting(WorkbookHistoryAction)
Invokes the RedoExecuting event before reapplying a history action.
Declaration
protected virtual void OnRedoExecuting(WorkbookHistoryAction historyAction)
Parameters
historyAction
The history action.
OnUndoExecuted(WorkbookHistoryAction)
Invokes the UndoExecuted event after completing an undo operation.
Declaration
protected virtual void OnUndoExecuted(WorkbookHistoryAction historyAction)
Parameters
historyAction
The history action.
OnUndoExecuting(WorkbookHistoryAction)
Invokes the UndoExecuting event before reversing a history action.
Declaration
protected virtual void OnUndoExecuting(WorkbookHistoryAction historyAction)
Parameters
historyAction
The history action.
Redo()
Reapplies the most recently undone action from the redo stack and returns whether the operation succeeded.
Declaration
public bool Redo()
Returns
The value indicating whether the redo was successfully performed.
Events
Cleared
Raised when all history entries are removed from the undo and redo stacks.
RecordExecuted
Raised after a history record is committed to the undo stack, providing the recorded action details.
Declaration
public event EventHandler<WorkbookHistoryRecordExecutedEventArgs> RecordExecuted
Event Value
RecordExecuting
Raised before a new history record begins recording, signaling the start of an undo group.
RedoExecuted
Raised after a redo operation completes, providing the action that was reapplied.
Declaration
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuted
Event Value
RedoExecuting
Raised before a redo operation begins, providing the action about to be reapplied.
Declaration
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuting
Event Value
UndoExecuted
Raised after an undo operation completes, providing the action that was reversed.
Declaration
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuted
Event Value
UndoExecuting
Raised before an undo operation begins, providing the action about to be reversed.
Declaration
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuting
Event Value