[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Selection
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Collapse]Drag-and-Drop
     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
     Move Nodes in TreeList
     Examples
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [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
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Drag-and-Drop Between Applications

The GridControl allows dragging records and dropping them in external applications. This topic demonstrates how to implement this behavior.

Expanded To Implement Drag-and-Drop Between Applications

The following image shows a drag-and-drop operation between GridControls in different applications:

Steps 1-2. Add Controls

  1. Add the GridControl to the first application:

  2. Add the GridControl to the second application:

Steps 3-5. Allow Drag-and-Drop

  1. Set the DataViewBase.AllowDragDrop property to true to enable drag-and-drop in the GridControl from the first application:

  2. Set the DataViewBase.AllowDragDrop property to true to enable drag-and-drop in the GridControl from the second application:

  3. Now you can drag records from the first application but not drop them in the second one. The following steps to allow dropping:

Steps 6-8. Transfer Data Between Applications

Note

Drag-and-drop between applications requires:

  • A basic data type (such as string, int, etc.) or
  • An object that implements the ISerializable interface which allows .NET to transfer your object into a stream of bytes and reconstruct the object in another application domain.

  1. Apply the SerializableAttribute attribute to the data type involved in the drag-and-drop operation to indicate that instances of this type can be serialized:

  2. Serialize data that is transferred from the first application:

  3. Retrieve serialized data that is transferred to the second application:

Expanded To Implement Drag-and-Drop Objects (for example, files) from an External Application to GridControl

Follow the steps from the tutorial above. In addition to these steps, in the DataViewBase.DropRecord event handler, you should convert dragged items to the target GridControl's data source type.

Expanded To Implement Drag-and-Drop from GridControl to Other Applications (for example, Excel)

Follow the steps from the tutorial above. In addition to these steps, in the DataViewBase.StartRecordDrag event handler, you should cutsomize DataObject to include data in the format the target application supports.

The code sample below shows how to prepare data for drag-and-drop to Excel. In this case, you should specify a string with the focused row's cell values separated by tabulation symbols:

Expanded See Also

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