2X faster development
The ultimate WPF UI toolkit to boost your development speed.
SfDataGrid provides support for ContextMenu interactive feature that is used to show the customizable menu for various parts of the SfDataGrid. You can show the ContextMenu in ColumnHeader by using the HeaderContextMenu. The CopyColumn and PasteColumn menu items are added as Collection of MenuItem to ItemsSource of ContextMenu of the SfDataGrid. The following code example illustrates to add the Menu Items into ContextMenu in SfDataGrid and to use single command for all MenuItems. XAML Figure 1: ContextMenu added to the Column Header The following code example illustrates the command for the above menu items, CopyColumn and PasteColumn to perform the copy and paste actions in column. C# While clicking on HeaderContextMenu, MyCommand gets triggered with parameter GridColumnContextMenuInfo that contains the following information, Column: Information about the column. DataGrid: The instance of SFDataGrid. From GridColumnContextMenuInfo, corresponding column is assigned to temporary variable as a GridColumn type when copy is performed and it is inserted into next index position when the paste option is clicked on HeaderContextMenu. Figure 2: RollNo is pasted as a New Column You can refer the sample from the below location.
|
2X faster development
The ultimate WPF UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.