AdvTree control includes automatic drag & drop support that you can use without writing a single line of code. Following properties are provided:

  • DragDropEnabled – Indicates whether internal automatic drag & drop support is enabled.
  • DragDropNodeCopyEnabled – Indicates whether when Ctrl key is pressed while dragging the node the node is copied instead of moved.
  • DropAsChildOffset – Specifies horizontal offset in pixels from left side of the node after which dragged node will be added as child node.
  • MultiNodeDragCountVisible – Specifies whether total number of nodes being dragged is visible during drag & drop
  • MultiNodeDragDropAllowed – Specifies whether multi-node drag & drop is enabled
  • AllowExternalDrop – Specifies whether internal drag and drop accepts the nodes from other AdvTree controls
  • Node.DragDropEnabled – Specifies whether node can be dragged

Following events are available to assist you with control of drag and drop operations:

  • BeforeNodeDragStart – Occurs before node drag is initiated. You can set Cancel on event arguments to cancel operation. Event arguments provide information about node being dragged etc.
  • NodeDragFeedback – Occurs while drag operation is in progress. You can set AllowDrop=false to disallow drop at specific locations. See sample project available below which show how to use this functionality. Event arguments provide information about the drag operation.
  • BeforeNodeDrop – Occurs after node is dropped and before drop operation is finalized. You can cancel the drop by setting Cancel=true on event arguments. You can also change the drop location and whether node is copied by changing properties on event arguments. See samples projects below for working code.

Following sample projects show how to use AdvTree drag & drop events to control how this operation is performed.

Click-here to download C# sample project.

Click-here to download VB sample project.

Related posts:

  1. How to accept external drag & drop on AdvTree control
  2. How to accept external drag & drop on TreeGX control
  3. How to enable drag & drop on ItemPanel control
  4. How to enumerate through all nodes in AdvTree control
  5. How to create custom columns when binding data to AdvTree