Search code examples
c#treecontroldotnetbar

Prevent drag drop on child nodes of DotNetBar AdvTree/TreeControl


I'm implementing a TreeControl using the DotNetBar Advtree component. However I seem to be struggling to find the property to make it impossible for a particular node to have any children. What I want to stop the following below;

How to stop this with the TreeControl component?

For example an RSS feed cannot be contained with an RSS feed. Some in effect I want some nodes to be draggable, and can have children, and others only draggable.

enter image description here

Thanks for any help. I've noticed the property NodesIndent which I've setting to -1, or 5000 but neither was any help.


Solution

  • Just spotted in the documentation;

    “Gets or sets the new insert position inside of NewParentNode.Nodes collection for the node being dragged. If InsertPosition is -1 the ParentNode refers to the current mouse over node and drag & drop node will be added as child node to it.”

    So basically I can capture whether or not it is being added to as child node, compare the node type and decide whether to accept the drop.