Back to Devexpress

Process Drag-and-Drop Operations

wpf-400431-controls-and-libraries-data-grid-drag-and-drop-process-drag-and-drop-operations.md

latest2.6 KB
Original Source

Process Drag-and-Drop Operations

  • Aug 15, 2025
  • 3 minutes to read

This topic demonstrates how to customize the GridControl‘s drag-and-drop functionality to support a wide variety of drag-and-drop scenarios.

To Prevent Dragging Specific Records

  1. Handle the DataViewBase.StartRecordDrag event.

  2. Define records that cannot be dragged.

  3. Set the StartRecordDragEventArgs.AllowDrag property to false to prevent records from being dragged.

  4. Set the Handled property to true.

To Prevent Dropping Items Into Specific Records

  1. Handle the DataViewBase.DragRecordOver event.

  2. Define records that reject the data.

  3. Set the Effects property to DragDropEffects.None to make the drop target reject the data.

  4. Set the Handled property to true.

To Customize Dragged Items

  1. Handle the DataViewBase.DropRecord event.

  2. Use the DataObject.GetData method to extract data.

  3. Modify extracted data.

To Prevent Removing Items After Dropping

  1. Handle the DataViewBase.CompleteRecordDragDrop event.

  2. Set the Handled property to true.

To Implement Drag-and-Drop Between Controls and Applications

The GridControl allows dragging records and dropping them in external controls that support drag-and-drop functionality. You can perform drag-and-drop operations within a single application, or between different applications. Refer to the following topics for more information:

See Also

Drag-and-Drop Options