DragDropManager.BeginDragDrop Event
Occurs when a drag-and-drop operation is initiated.
Namespace: DevExpress.Utils.DragDrop
Assembly: DevExpress.Utils.v21.2.dll
NuGet Packages: DevExpress.Utils, DevExpress.Win.Design, DevExpress.Wpf.Core
Declaration
Event Data
The BeginDragDrop event's data class is BeginDragDropEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Data | Gets or sets the dragged data elements. |
PreviewImage | Gets or sets a preview of dragged data elements (rows/nodes/items). |
Example
This example shows how to cancel a drag operation for a specific tree list node.
//You can cancel a drag-and-drop operation.
private void DragDropEvents2_BeginDragDrop(object sender, BeginDragDropEventArgs e) {
//If the source control is a tree list,
//the Data argument contains the collection of tree list nodes being dragged.
List<TreeListNode> list = e.Data as List<TreeListNode>;
if (list.Find((x) => x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) != null) {
//Set Cancel to true to prohibit the operation.
e.Cancel = true;
}
}
Note
Run the XtraTreeList or XtraGrid demo and click Open Solution for more examples.
See Also