Treelist - 从父母预防中拖出来 [英] Treelist - dragging from parent prevention
问题描述
您好
我正在使用表单上的树形图,我正在尝试限制拖放。这是我的情景:
- 1-top level
- 1.1 Assy
-        1.1.1部分
-        1.1.2部分
-        1.1.3部分
- 1.2 Assy
-        1.2.1部分
-        1.2.2部分
- 1.3部分
- 1.4 Assy
-        1.4.1部分
-        1.4.2 Assy
-                 1.4.2.1部分
-                 1.4.2.2部分
-        1.4.3部分
我需要能够
- 移动1.1,1.2,1.3, 1.4在顶级但不进入任何其他级别1子节点与子节点一起移动
- 在1.1内移动1.1.1,1.1.2,1.1.3但不从1.1移除
等等。基本上,级别保持完全相同但我可以调整子节点的位置以进行重组。没有孩子可以被拖入或拖出父母。
我尝试了各种策略,但我似乎仍然可以将1.4.2.2的说法拖到1.4.2.1上来制作一个新的等级...
任何方便的好代码片段?
谢谢
纳乔是奈杰尔的衍生物 - 真实的事实!我是VB.Net的自学者。 50%的时间,我100%正确!
Hey Nacho,
我认为您可以检查拖动的节点父节点是否与DestinationNode节点相同?
https: //msdn.microsoft.com/en-us/library/5wte3waa(v=vs.110).aspx
Hi
I am working with a treelist on my form and I am trying to restrict drag / drop. here is my scenario:
- 1-top level
- 1.1 Assy
- 1.1.1 Part
- 1.1.2 Part
- 1.1.3 Part
- 1.2 Assy
- 1.2.1 Part
- 1.2.2 Part
- 1.3 Part
- 1.4 Assy
- 1.4.1 Part
- 1.4.2 Assy
- 1.4.2.1 Part
- 1.4.2.2 Part
- 1.4.3 Part
I need to be able to
- move 1.1, 1.2, 1.3, 1.4 within the top level but not into any other level 1 child and child nodes move with parent
- move 1.1.1, 1.1.2, 1.1.3 within 1.1 but not remove from 1.1
etc etc. So basically, the levels remain exactly the same but I can adjust the positions with the child nodes for re-organization. No childs can be dragged in or out of a parent.
I have tried various tactics but I still seem to be able to drag say, 1.4.2.2 onto 1.4.2.1 to make a new level...
Any good code snippets that are handy?
Thanks
Nacho is the derivative of Nigel - True fact! I am self taught in VB.Net. 50% of the time, I am right 100% of the time!
Hey Nacho,
I think you can check that the dragged node parent was the same as the DestinationNode node?
https://msdn.microsoft.com/en-us/library/5wte3waa(v=vs.110).aspx
这篇关于Treelist - 从父母预防中拖出来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!