Drag-and-Drop Options
- 3 minutes to read
The GridControl has a set of properties and events that allow you to control drag-and-drop operations at different stages.
#Common
Use the following properties to enable drag-and-drop operations:
Property | Description |
---|---|
Data |
Gets or sets whether an end user can drag and drop grid view’s records. |
Data |
Gets or sets whether an end user can drag and drop sorted or grouped data. |
The GridControl with the drag-and-drop functionality enabled requires 2 mouse clicks to activate a cell editor and 3 clicks to open a drop-down editor. You can set the DataViewBase.EditorShowMode property to MouseDownFocused
or MouseUp
to reduce the number of clicks.
#The Beginning of the Drag-and-drop Operation
You can prevent the drag-and-drop operation or customize the dragged data:
Event | Description |
---|---|
Data |
Occurs when a drag-and-drop operation is started. You can use this event to modify dragged data or forbid dragging specific records. |
#The Dragging Process
You can specify how your source and target grids behave during the drag-and-drop operation, and customize the drop hint and marker elements’ appearance:
Property | Description |
---|---|
Data |
Gets or sets whether dragging records over a collapsed group automatically expands this group. |
Data |
Gets or sets the delay after which the collapsed group is expanded, in milliseconds. |
Data |
Gets or sets whether dragging records to the edges of the grid’s view automatically activates scrolling. |
Data |
Gets or sets whether the drag-and-drop hint is displayed when dragging a record. |
Data |
Gets or sets whether the drag-and-drop hint shows information about a drop target. |
Data |
Gets or sets the template that defines the drag-and-drop hint‘s presentation. |
Data |
Gets or sets the template that defines the drop marker‘s presentation. |
Event | Description |
---|---|
Data |
Occurs continuously while a record is dragged within the drop target’s boundary. You can use this event to check dragged data availability, deny a drop operation over specific records, or set a drop position. |
Data |
Occurs continuously during a drag-and-drop operation and enables the drop source to give feedback to the user. |
Data |
Occurs when there is a change in the keyboard or mouse button states during a drag-and-drop operation, and enables the drop source to cancel the drag-and-drop operation depending on the key/button states. |
#The End of the Drag-and-drop Operation
You can reorder items, customize dropped data, and prevent removing the dragged items from the source grid:
Event | Description |
---|---|
Data |
Occurs when a record is dropped on the target element. You can use this event to process dropped data. |
Data |
Occurs when a drag-and-drop operation is completed. You can use this event to cancel removing records after dropping or add additional actions. |
Tip
For the List