DragDropBehavior Class
Represents the Drag-and-Drop Behavior that can be attached to a data control to allow users to move/reorder data elements with the mouse.
Namespace: DevExpress.Utils.DragDrop
Assembly: DevExpress.Utils.v24.1.dll
NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core
Declaration
public sealed class DragDropBehavior :
DragDropBehaviorBase<IDragDropBehaviorSource, DragDropBehaviorProperties>
Remarks
Use the BehaviorManager.Attach
method to assign the behavior to a control in code or the BehaviorManager.Detach
method to remove it. The code below shows how to assign the behavior to two grids, specify options, and add event handlers.
using DevExpress.Utils.Behaviors;
using DevExpress.Utils.DragDrop;
BehaviorManager behaviorManager1 = new BehaviorManager(this.components);
//To assign the Behavior to a control in code, use the Attach method.
behaviorManager1.Attach<DragDropBehavior>(gridView1, behavior => {
behavior.Properties.AllowDrop = true;
behavior.Properties.InsertIndicatorVisible = true;
behavior.Properties.PreviewVisible = true;
behavior.DragDrop += Behavior_DragDropToGrid1;
});
behaviorManager1.Attach<DragDropBehavior>(gridView2, behavior => {
behavior.Properties.AllowDrop = false;
behavior.Properties.InsertIndicatorVisible = false;
behavior.Properties.PreviewVisible = false;
behavior.DragDrop += Behavior_DragDropToGrid2;
});
//To remove the Behavior, use the Detach method.
behaviorManager1.Detach<DragDropBehavior>(gridView1);
behaviorManager1.Detach<DragDropBehavior>(gridView2);
Inheritance
Object
DevExpress.Utils.MVVM.BehaviorBase
DevExpress.Utils.Behaviors.Behavior
DevExpress.Utils.Behaviors.Behavior<DevExpress.Utils.DragDrop.IDragDropBehaviorSource>
DevExpress.Utils.Behaviors.BehaviorWithEvents<DevExpress.Utils.DragDrop.IDragDropBehaviorSource>
DragDropBehaviorBase<DevExpress.Utils.DragDrop.IDragDropBehaviorSource, DragDropBehaviorProperties>
DragDropBehavior
See Also