Class HistoryManager
Represents class which manages the undo and redo operations in Syncfusion.UI.Xaml.Spreadsheet.History.HistoryManager.SfSpreadsheet.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.Spreadsheet.History
Assembly: Syncfusion.SfSpreadsheet.WPF.dll
Syntax
public sealed class HistoryManager : Object, IDisposable
Constructors
HistoryManager(SfSpreadsheet)
Initializes a new instance of the HistoryManager class.
Declaration
public HistoryManager(SfSpreadsheet sfSpreadsheet)
Parameters
Type | Name | Description |
---|---|---|
SfSpreadsheet | sfSpreadsheet | An instance of Syncfusion.UI.Xaml.Spreadsheet.History.HistoryManager.SfSpreadsheet. |
Properties
Enabled
Gets or sets the value for enabling the command stack. By default it has been in disabled mode. When enabled this, command actions are saved in undo/redo stack for memory transaction.
Declaration
public bool Enabled { get; set; }
Property Value
Type |
---|
System.Boolean |
RedoStack
Gets the stack with redo commands.
Declaration
public Stack<HistoryCommandBase> RedoStack { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Stack<HistoryCommandBase> | A collection of commands. |
UndoStack
Gets the stack with undo commands .
Declaration
public Stack<HistoryCommandBase> UndoStack { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Stack<HistoryCommandBase> | A collection of commands. |
Methods
BeginTransaction(String)
Starts a transaction that combines several subsequent commands into one transaction.
Declaration
public void BeginTransaction(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | A description for the transaction. This text can appear for example as "Undo" information in a menu to give feedback to the user about command on the undo stack. |
Remarks
is switched into a special mode where new commands will not be pushed onto the undo stack. Instead all new commands will be pushed into the current HistoryTransactionCommand instance.
When you call
When you call BeginTransaction(String), an internal counter will increase but no additional HistoryTransactionCommand is
created. Only once you call
That means nested transactions are supported. But when you Undo() or
CommitTransaction()
Ends a transaction that was started with a previous BeginTransaction(String) call.
Declaration
public void CommitTransaction()
Remarks
See BeginTransaction(String) for discussion about transaction in a Spreadsheet.
CommitTransaction(IRange[])
Ends a transaction that was started with a previous BeginTransaction(String) call.
Declaration
public void CommitTransaction(IRange[] ranges)
Parameters
Type | Name | Description |
---|---|---|
IRange[] | ranges |
Remarks
See BeginTransaction(String) for discussion about transaction in a SpreadsheetCommandStack.
Dispose()
Releases all resources used by the. HistoryManager.
Declaration
public void Dispose()
Push(HistoryCommandBase)
Pushes a command onto the undo stack.
Declaration
public void Push(HistoryCommandBase cmd)
Parameters
Type | Name | Description |
---|---|---|
HistoryCommandBase | cmd | The HistoryCommandBase with undo information. |
Remarks
When the spredsheet performing an Undo(), the command will be pushed onto the redo stack. Otherwise, commands are pushed onto the undo stack.
Redo()
Execute the latest command from the redo stack.
Declaration
public void Redo()
Reset()
Removes or clears the commands from undo and redo stack.
Declaration
public void Reset()
Undo()
Execute the latest command from the undo stack.
Declaration
public void Undo()
Remarks
The redo stack will be cleared.