The following example demonstrates how to copy rows selected in a datagrid control to the clipboard, using XAML.
XAML |
Copy Code |
---|---|
<!—Button bound to the ApplicationCommands.Copy with DataGridControl as CommandTarget --> <Button Command="ApplicationCommands.Copy" CommandTarget="{Binding ElementName=testGrid}" Content="Start Test" /> <Grid MaxHeight="800"> <xcdg:DataGridControl x:Name="testGrid" ItemsSource="{Binding Source={StaticResource cvs_Data}}" ItemScrollingBehavior="Immediate" Height="400" /> </Grid> |
The following example demonstrates how to copy rows selected in a datagrid control to the clipboard using code behind.
VB.NET |
Copy Code |
---|---|
' Where testGrid is the DataGridControl. This sends the RoutedCommand Copy ' to the DataGridControl so that the control can handle it. ApplicationCommands.Copy.Execute(Nothing, Me.testGrid) |
C# |
Copy Code |
---|---|
// Where testGrid is the DataGridControl. This sends the RoutedCommand Copy // to the DataGridControl so that the control can handle it. ApplicationCommands.Copy.Execute( null, this.testGrid ); |