Version

Perform Clipboard Operations

The DataPresenter controls map their clipboard operations to common keyboard shortcuts found in many operating systems. For example, the DataPresenter controls map their copy operation to the 'CTRL + C' keyboard shortcut. However, you may want to expose the clipboard functionality through an application menu so that your end users can access it easily. Fortunately, the DataPresenterCommands class exposes the following clipboard commands that you can hook up to menu items or buttons:

The following example code demonstrates how to perform a clipboard operation. You must enable clipboard operations in order to enable the clipboard commands.

In XAML:

<Button
    Content="Delete Selected Values"
    Command="{x:Static igDP:DataPresenterCommands.ClearCellContents}"
    CommandTarget="{Binding ElementName=xamDataPresenter1}" />
<igDP:XamDataPresenter Name="xamDataPresenter1" BindToSampleData="True">
    <!--You must enable clipboard operations in order to enable clipboard commands-->
    <igDP:XamDataPresenter.FieldLayoutSettings>
        <igDP:FieldLayoutSettings AllowClipboardOperations="All" />
    </igDP:XamDataPresenter.FieldLayoutSettings>
</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.ClearCellContents)
...

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.ClearCellContents);
...