Spread Silverlight Documentation
Using Undo and Redo
Spread Silverlight Documentation > Developer's Guide > Managing the User Interface > Using Undo and Redo

You can use Ctrl + Z to undo an action in the control. You can then use Ctrl + Y to redo the action you canceled.

You can undo the following types of actions:

The following actions do not respond to Ctrl + Z:

You can prevent or allow the undo action in code with the CanUserUndo property.

Using Code

The following example creates an action that can be undone.

CS
Copy Code

gcSpreadSheet1.CanUserUndo = true;

 private void button1_Click(object sender, RoutedEventArgs e)
        {
GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupExtent group = new GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupExtent(3, 5);
GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupUndoAction action = new GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupUndoAction(this.gcSpreadSheet1.ActiveSheet, group);
this.gcSpreadSheet1.DoCommand(action);
gcSpreadSheet1.Invalidate();
        }

VB.NET
Copy Code

GcSpreadSheet1.CanUserUndo = True

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Dim group As New GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupExtent(3, 5)
        Dim action As New GrapeCity.Windows.SpreadSheet.UI.UndoRedo.RowGroupUndoAction(GcSpreadSheet1.ActiveSheet, group)
        GcSpreadSheet1.DoCommand(action)
        GcSpreadSheet1.Invalidate()
    End Sub

See Also