Skip to main content
A newer version of this page is available. .

Drag-and-Drop Managers

  • 2 minutes to read

You can use Drag-and-Drop Managers to enable drag-and-drop functionality. This approach is legacy.

Note

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
TableView GridDragDropManager DevExpress.Xpf.Grid.v19.1.Extensions
TreeListView TreeListDragDropManager DevExpress.Xpf.Grid.v19.1.Extensions

Enabling Drag-and-Drop

Perform the following steps to enable drag-and-drop:

  1. Add a reference to the DevExpress.Mvvm.v19.1.dll assembly and specify the corresponding namespace in XAML:

    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    
  2. Add a reference to the DevExpress.Xpf.Grid.v19.1.Extensions assembly.
  3. 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:

Property Description
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:

Event Description
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.