WPF

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class HistoryManager

    Show / Hide Table of Contents

    Class HistoryManager

    Represents class which manages the undo and redo operations in Syncfusion.UI.Xaml.Spreadsheet.History.HistoryManager.SfSpreadsheet.

    Inheritance
    System.Object
    HistoryManager
    Implements
    System.IDisposable
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.UI.Xaml.Spreadsheet.History
    Assembly: Syncfusion.SfSpreadsheet.WPF.dll
    Syntax
    public sealed class HistoryManager : 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 Description
    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 CommitTrans , the current HistoryTransactionCommand command will be pushed onto the undo stack and the SpreadsheetCommandManager will switch back to its default behavior where new commands are pushed onto the undo stack.

    When you call BeginTransaction(String), an internal counter will increase but no additional HistoryTransactionCommand is created. Only once you call CommitTrans as many times as you have called BeginTransaction(String) will the transaction will be considered complete and the current HistoryTransactionCommand command will be pushed onto the undo stack.

    That means nested transactions are supported. But when you Undo() or Rollback a transaction, all nested transaction will be treated as one single transaction.

    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.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved