Professional Documents
Culture Documents
Add Undo - Redo or Back - Forward Functionality To Your Application
Add Undo - Redo or Back - Forward Functionality To Your Application
CurrentItem: This holds the current item. It is neither in the undo stack nor the redo stack. It is in
between the two of them.
UndoHappened: This event is fired when Undo method is called.
RedoHappened: This event is fired when Redo method is called.
Clear: Calling this method will clear both the stacks as well as the current item. It is as good as
creating a new instance of this class.
AddItem: This method is used to add items to our undo list. This is the only way at present to add
items to our undo stack.
Undo: Calling this method will undo the last item added to our undo list. The item is moved to
redo list.
Redo: Calling this method will redo the last item added to the redo list. The item is moved to
undo list.
CanUndo: This method can be used to check whether undo is possible or not. It is useful when we
want to take decisions like disabling the undo bu ons etc. when undo is not possible.
CanRedo: This method can be used to check whether redo is possible or not. It is useful when we
want to take decisions like disabling the redo bu ons etc. when redo is not possible.
UndoItems: Returns a list of undo items we currently have in the undo stack.
RedoItems: Returns a list of redo items we currently have in the redo stack.
UndoRedoEventArgs: This is the eventargs for our UndoHappened and RedoHappened events.
The e.CurrentItem will have the current item which was undone/redone.