If the UndoEnabled property is set to true, the control records users actions and allows undoing them later. The records are stored in a list, and can be undone consecutively by calling the Undo method of the Schedule class. An action that has been undone can be redone by calling the Redo method. You can enable or disable UI elements that undo or redo commands by inspecting the values of the CanUndo and CanRedo properties.
The control also runs and saves in the undo history AddItemCommand and RemoveItemCommand commands when items are programmatically added or removed from the Items collection of the Schedule. No other changes are recorded automatically when done from code. If support for undo/redo of such changes is required, they must be done through the ExecuteCommand method.
To allow undoing changes of Item properties, create a ChangeItemCommand instance before setting the property values, and call ExecuteCommand afterwards. Any other types of undoable changes can be implemented by deriving from the Command class and overriding its Execute, Undo and Redo methods.
Note |
---|
Changes made to the schedule during in-place editing or creation of an item while Undo/Redo is enabled are not supported and will usually result in broken undo consistency or errors. Any modifications to the schedule should be performed before the in-place operation has begun or after it has ended. |