Version

Perform an Undo Operation

The DataPresenter controls map their undo and redo operations to common keyboard shortcuts found in many operating systems. For example, the DataPresenter controls map their undo operation to the 'CTRL + Z' keyboard shortcut. However, you can also perform undo/redo operations in code or XAML by executing the following commands exposed by the DataPresenterCommands class:

The following example code demonstrates how to perform an undo operation. You must enable undo operations and perform an action on the DataPresenter control in order to enable the undo command.

In XAML:

<Button
    Content="Undo Action"
    Command="{x:Static igDP:DataPresenterCommands.Undo}"
    CommandTarget="{Binding ElementName=xamDataPresenter1}" />
<!--You must enable undo operations to enable the undo/redo commands-->
<igDP:XamDataPresenter Name="xamDataPresenter1" BindToSampleData="True" IsUndoEnabled="True">
</igDP:XamDataPresenter>

In Visual Basic:

Imports Infragistics.Windows.DataPresenter
...
'TODO: Place this code in an event handler such as a Button's Click event
Me.xamDataPresenter1.ExecuteCommand(DataPresenterCommands.Undo)
...

In C#:

using Infragistics.Windows.DataPresenter;
...
//TODO: Place this code in an event handler such as a Button's Click event
this.xamDataPresenter1.ExecuteCommand(DataPresenterCommands.Undo);
...