Class
WorkbookHistory

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:

cs-api-definition
public class WorkbookHistory

Inheritance: objectWorkbookHistory

Fields

DefaultDepth

The default depth of the workbook history.

Declaration

cs-api-definition
public const int DefaultDepth = 2147483647

Field Value

int

Properties

CanRedo

Indicates whether the redo stack contains actions available to reapply.

Declaration

cs-api-definition
public bool CanRedo { get; }

Property Value

bool

The value indicating whether redo can be performed.

CanUndo

Indicates whether the undo stack contains actions available to reverse.

Declaration

cs-api-definition
public bool CanUndo { get; }

Property Value

bool

The value indicating whether undo can be performed.

Depth

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

Declaration

cs-api-definition
public int Depth { get; set; }

Property Value

int

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

cs-api-definition
public bool IsEnabled { get; set; }

Property Value

bool

The value indicating whether history is enabled.

IsInUndoGroup

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

Declaration

cs-api-definition
public bool IsInUndoGroup { get; }

Property Value

bool

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

Workbook

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

Declaration

cs-api-definition
public Workbook Workbook { get; }

Property Value

Workbook

The workbook.

Methods

BeginUndoGroup()

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

Declaration

cs-api-definition
public void BeginUndoGroup()

CancelUndoGroup()

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

Declaration

cs-api-definition
public void CancelUndoGroup()

Clear()

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

Declaration

cs-api-definition
public void Clear()

EndUndoGroup()

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

Declaration

cs-api-definition
public void EndUndoGroup()

OnCleared()

Invokes the Cleared event after removing all history entries.

Declaration

cs-api-definition
protected virtual void OnCleared()

OnRecordExecuted(WorkbookHistoryAction, bool)

Invokes the RecordExecuted event after committing a history action.

Declaration

cs-api-definition
protected virtual void OnRecordExecuted(WorkbookHistoryAction historyAction, bool isMerged)

Parameters

historyAction

WorkbookHistoryAction

The history action.

isMerged

bool

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

OnRecordExecuting()

Invokes the RecordExecuting event when history recording starts.

Declaration

cs-api-definition
protected virtual void OnRecordExecuting()

OnRedoExecuted(WorkbookHistoryAction)

Invokes the RedoExecuted event after completing a redo operation.

Declaration

cs-api-definition
protected virtual void OnRedoExecuted(WorkbookHistoryAction historyAction)

Parameters

historyAction

WorkbookHistoryAction

The history action.

OnRedoExecuting(WorkbookHistoryAction)

Invokes the RedoExecuting event before reapplying a history action.

Declaration

cs-api-definition
protected virtual void OnRedoExecuting(WorkbookHistoryAction historyAction)

Parameters

historyAction

WorkbookHistoryAction

The history action.

OnUndoExecuted(WorkbookHistoryAction)

Invokes the UndoExecuted event after completing an undo operation.

Declaration

cs-api-definition
protected virtual void OnUndoExecuted(WorkbookHistoryAction historyAction)

Parameters

historyAction

WorkbookHistoryAction

The history action.

OnUndoExecuting(WorkbookHistoryAction)

Invokes the UndoExecuting event before reversing a history action.

Declaration

cs-api-definition
protected virtual void OnUndoExecuting(WorkbookHistoryAction historyAction)

Parameters

historyAction

WorkbookHistoryAction

The history action.

Redo()

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

Declaration

cs-api-definition
public bool Redo()

Returns

bool

The value indicating whether the redo was successfully performed.

Undo()

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

Declaration

cs-api-definition
public bool Undo()

Returns

bool

The value indicating whether the undo was successfully performed.

Events

Cleared

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

Declaration

cs-api-definition
public event EventHandler Cleared

Event Value

EventHandler

RecordExecuted

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

Declaration

cs-api-definition
public event EventHandler<WorkbookHistoryRecordExecutedEventArgs> RecordExecuted

Event Value

EventHandler<WorkbookHistoryRecordExecutedEventArgs>

RecordExecuting

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

Declaration

cs-api-definition
public event EventHandler RecordExecuting

Event Value

EventHandler

RedoExecuted

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

Declaration

cs-api-definition
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuted

Event Value

EventHandler<WorkbookHistoryEventArgs>

RedoExecuting

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

Declaration

cs-api-definition
public event EventHandler<WorkbookHistoryEventArgs> RedoExecuting

Event Value

EventHandler<WorkbookHistoryEventArgs>

UndoExecuted

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

Declaration

cs-api-definition
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuted

Event Value

EventHandler<WorkbookHistoryEventArgs>

UndoExecuting

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

Declaration

cs-api-definition
public event EventHandler<WorkbookHistoryEventArgs> UndoExecuting

Event Value

EventHandler<WorkbookHistoryEventArgs>