In the SfDataGrid, it is not possible to perform row drag and drop operation within a grid and from one SfDataGrid to another, by default. You can achieve this by deriving new class from the GridSelectionController class in the SfDataGrid. Refer to the links , for more information.
Likewise, you can perform row drag and drop operations from one Detailsview to another Detailsview by deriving new class from the GridSelectionController and overriding its virtual method, HandlePointerOperations().
To handle Drag and Drop of data, you need to wire the following VisualContainer’s events in the derived SelectionController class:
You need to instantiate the instance of the new class, GridSelectionControllerExt that is derived from the GridSelectionController for the DetailsView DataGrid’s SelectionController property to achieve the Drag and Drop between two DetailsViewGrid as shown in the following code example.
The following code example shows how to derive a new class from the GridSelectionController.
The earlier mentioned VisualContainer event is wired and unwired in the Loaded and Unloaded events of the SfDataGrid as shown in the following code example.
In the HandlePointerOperations() virtual method, you can set IsPointerPressed to true when the mouse pointer is pressed on the row of any of the two Detailsview DataGrid and you can also set IsPointerPressed to false when the mouse pointer is released.
The following code example illustrates how to override the HandlePointerOperations() virtual method in the GridSelectionController class.
You can drag the row data from one DetailsviewGrid to another DetailsviewGrid or vice versa in the PreviewMouseMove event of the VisualContainer. You can get the corresponding row and column index based on the mouse pointer position by using the PointToCellRowColumnIndex () method in the VisualContainer.
You need to resolve the record index by the ResolveToRecordIndex() helper method in the SfDataGrid to retrieve the exact row data on view under mouse position. Now, drag the record with the specified DragDropEffects by using the WPF DragAndDrop as illustrated in the following code example.
You can perform the Drop operation by using the PreviewDrop event of the VisualContainer. The PreviewDrop event is fired when the row data is dropped into a particular position of the SfDataGrid. You need to check whether the dragged record and the DataGrid is matched with specified format and the dragged record is inserted into a particular position of the DetailsviewGrid as shown in the following code example.
You can refer to the following link for Drag-and-Drop row from one DetailsviewGrid to another DetailsviewGrid in the WPF platform.
This page will automatically be redirected to the sign-in page in 10 seconds.