If you use GanttChartDataGrid (or another) control from DlhSoft Gantt Chart Light Library (available for both Silverlight™ and WPF) and you need built-in Undo/Redo support to enable an action queue in your application:
- set IsUndoEnabled property of the control instance to true;
- determine whether undoing or redoing actions is possible at any moment by calling CanUndo and CanRedo methods of the control;
- call Undo and Redo methods whenever needed (e.g. when the end user clicks one of the the Undo and Redo buttons or menu items in your own toolbar or menu).
If you want to customize the feature further, these properties will probably help you:
- UndoLimit – allows you to specify a limit for the internal Undo queue (to limit internal memory usage);
- UndoLinkingTimeLimit – allows you to specify a time interval value to consider when linking separate actions as action groups to be undone and redone together (very useful for recording partially continuous drag and drop operations as unitary actions);
- UndoQueueCount – retreives how many unitary actions are currently recorded within the Undo queue (you can clear the queue by calling ClearUndoQueue method, if needed).
Finally, if you inherit from GanttChartItem type to provide custom properties for your data items and need them to be handled by the internal Undo/Redo mechanism, you just need to make sure your properties are set up as dependency properties and to call the protected OnManagedDependencyPropertyChanged method of the component, passing the event arguments you receive upon your DependencyPropertyChanged callbacks. Here is an example for a property named MyValue:
public class CustomGanttChartItem : GanttChartItem
public static readonly DependencyProperty MyValueProperty =
public string MyValue
private static void OnMyValueChanged(