In SfDataGrid, you can enable copy and paste option by setting value to SfDataGird.GridCopyoption and SfDataGrid.GridPasteoption. You can use the copy and paste options through keyboard shortcuts. And you can also copy, paste data programmatically in SfDataGrid using the following methods.
The following section explains how to integrate programmatic copy paste with Ribbon and ContextMenu
Integrating SfDataGrid copy paste with Ribbon
Here, Ribbon is designed with Button for performing copy paste operations and SfDataGrid is also defined in XAML. Ribbon button commands are bound with corresponding commands and SfDataGrid is passed as CommandParameter.
The following code example illustrates the RibbonButton actions for the cut, copy and paste operation.
The following screenshot illustrates the cut, copy and paste operation in SfRibbon.
Figure 1: Cut, copy and paste operation in SfRibbon
Integrating SfDataGrid copy paste with ContextMenu
You can set ContextMenu for record cells in SfDataGrid using SfDataGrid.RecordContextMenu as illustrated in the following code example. Here, copy and paste operations in SfDataGrid is integrated with ContextMenu through commands. Also default CommandParameter of RecordContextMenu from SfDataGrid (namely GridRecordContextMenuInfo) is passed to commands.
The following code example illustrates the actions for cut, copy and paste operation.
The following screenshot illustrates the cut, copy and paste operation in ContextMenu
Figure 2: Cut, copy and paste operation in ContextMenu
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|
or the page will be automatically redirected to sign-in page in 10 seconds.