- 2 minutes to read
You can use Drag-and-Drop Managers to enable drag-and-drop functionality. This approach is legacy.
The GridControl v17.2 and later ships with native drag-and-drop support. Set the DataViewBase.AllowDragDrop property to true to enable drag-and-drop.
Each grid view has a specific drag-and-drop manager:
|Grid View||Drag and Drop Manager||Assembly|
Perform the following steps to enable drag-and-drop:
Add a reference to the DevExpress.Mvvm.v21.1.dll assembly and specify the corresponding namespace in XAML:
- Add a reference to the DevExpress.Xpf.Grid.v21.1.Extensions assembly.
Add the required Drag and Drop Manager to the GridControl’s Interaction.Behaviors collection:
<dxg:GridControl> <dxg:GridControl.View> <dxg:TableView /> </dxg:GridControl.View> <dxmvvm:Interaction.Behaviors> <dxg:GridDragDropManager /> </dxmvvm:Interaction.Behaviors> </dxg:GridControl>
Drag-and-Drop Managers Customization
Use the following properties to customize the drag-and-drop manager:
|AllowDrag||Specifies whether an end-user can drag rows/nodes within a grid’s view.|
|AllowDrop||Specifies whether an end-user can drop rows/nodes within a grid’s view.|
|AllowScrolling||Specifies whether dragging rows/nodes to the edges of the grid’s view automatically activates scrolling.|
Handle the required event(s) to control drag-and-drop operations manually:
|StartDrag||Occurs before a drag-and-drop operation is started. You can handle this event to prevent dragging.|
|DragOver||Occurs repeatedly during a drag-and-drop operation. This event enables you to control whether an end-use can drop a row/node on the current position.|
|Drop||Occurs after a drag-and-drop operation has completed.|
Drag-and-Drop Managers Limitations
- Drag-and-drop between applications is not supported.
- You can only drag and drop records to controls with an attached DragDropManager class.