DXDefaultEventArgs.Default() Method
Invokes the default action the attached control performs on the current drag-and-drop operation stage.
Namespace: DevExpress.Utils.DragDrop
Assembly: DevExpress.Utils.v24.2.dll
Declaration
Remarks
Controls that support the Drag-and-Drop Behavior have a default action for each stage of a drag-and-drop operation. For instance, when data elements are dragged over a control, the control calculates the insert indicator’s bounds. When data elements are dropped, the control moves or copies data elements. The following arguments allow you to invoke or suppress the default action:
The Handled property - gets or sets whether you handled the event. If the event is handled, the control does not perform the default action.
The
Default()
method - invokes the default action. If you call this method, the Handled property is automatically set totrue
.If you want to implement your own action on a particular operation stage, set the Handled property to
true
to disable the default action. Use theDefault()
method to calculate event arguments and then change the action. In the example below, users can only insert data items as child nodes.dragDropEvents1.DragOver += DragDropEvents1_DragOver; //The code below only allows users to insert data as child nodes in a tree list. private void DragDropEvents1_DragOver(object sender, DevExpress.Utils.DragDrop.DragOverEventArgs e) { e.Default(); if (e.InsertType != DevExpress.Utils.DragDrop.InsertType.AsChild){ e.Action = DevExpress.Utils.DragDrop.DragDropActions.None; e.InsertType = DevExpress.Utils.DragDrop.InsertType.None; } else { e.Action = DevExpress.Utils.DragDrop.DragDropActions.All; } }
Note
The grid provides specific methods to calculate event arguments.
- For the DragOver event - the static (Shared in VB) GetDragOverGridEventArgs(DragOverEventArgs) method.
- For the DragDrop event - the static (Shared in VB) GetDragDropGridEventArgs(DragDropEventArgs) method.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Default() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.