[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Filtering and Searching
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
     Drag-and-Drop Options
    [Collapse]Process Drag-and-Drop Operations
      Drag-and-Drop Between GridControl and ListBoxEdit
      Drag-and-Drop Between GridControls
      Drag-and-Drop Between GridControl and Other Controls
      Drag-and-Drop Between Applications
     Drag-and-Drop Hint
     Drop Marker
     Drag-and-Drop Managers
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Process Drag-and-Drop Operations

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

Expanded 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.

    The code sample above allows dragging only leaf nodes.

Expanded 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.

Expanded To Customize Dragged Items

  1. Handle the DataViewBase.DropRecord event.

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

  3. Modify extracted data.

    Refer to the How to: Manually Control Drag-and-Drop example for more information.

Expanded To Prevent Removing Items After Dropping

  1. Handle the DataViewBase.CompleteRecordDragDrop event.

  2. Set the Handled property to true.

Expanded 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:

Expanded See Also

Is this topic helpful?​​​​​​​