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.

有帮助吗?

解决方案 2

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.

其他提示

According to http://www.devcomponents.com/kb2/?p=327, there is a DragDropEnabled property to control this. If that does not work, handle the BeforeNodeDragStart event and cancel the drag.

[Edit: Added the following]

To prevent dragging a node under certain nodes and not others, handle the BeforeNodeDrop event and setting Cancel=true if the node being dragged cannot be added as a child to the destination node.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top