侵犯选择节点
想知道我是错误还是我遇到了一个错误。
我和父母和孩子有一个网格。我已经制作了按钮将节点从上到下和背面移动。这有效,但是仍然选择了第一个选定的节点。应根据需要移动应移动的节点。为什么仍然显示第一个选定的节点?
private void IDC_ARROW_UP_Click(object sender, System.EventArgs e)
{
foreach (Infragistics.Win.UltraWinTree.UltraTreeNode Node in this.uTreeMenue.SelectedNodes)
{
Node.Reposition(Node, Infragistics.Win.UltraWinTree.NodePosition.Previous);
Node.Selected = true;
}
}
所选节点如下所示:
---编辑:
private void IDC_ARROW_UP_Click(object sender, System.EventArgs e)
{
var NodeSelected = uTreeMenue.SelectedNodes;
var NodeCount = NodeSelected.Count;
NodeSelected.SortByPosition();
if (NodeCount > 0 && NodeSelected[0].PrevVisibleNode is Infragistics.Win.UltraWinTree.UltraTreeNode Node)
Node.Reposition(NodeSelected[NodeCount - 1], Infragistics.Win.UltraWinTree.NodePosition.Next);
}
--- down_click_method相同
Would like to know if I am the error or I have encountered a bug.
I have a grid with parents and children. I have made buttons to move the nodes from top to bottom and back. This works, but the first selected node remains selected. The node that should be moved can be moved as desired. Why is the first selected node still displayed?
private void IDC_ARROW_UP_Click(object sender, System.EventArgs e)
{
foreach (Infragistics.Win.UltraWinTree.UltraTreeNode Node in this.uTreeMenue.SelectedNodes)
{
Node.Reposition(Node, Infragistics.Win.UltraWinTree.NodePosition.Previous);
Node.Selected = true;
}
}
Selected node is shown below:
---EDIT:
private void IDC_ARROW_UP_Click(object sender, System.EventArgs e)
{
var NodeSelected = uTreeMenue.SelectedNodes;
var NodeCount = NodeSelected.Count;
NodeSelected.SortByPosition();
if (NodeCount > 0 && NodeSelected[0].PrevVisibleNode is Infragistics.Win.UltraWinTree.UltraTreeNode Node)
Node.Reposition(NodeSelected[NodeCount - 1], Infragistics.Win.UltraWinTree.NodePosition.Next);
}
---Same for the Down_Click_Method
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下代码:
上面代码中实现的逻辑非常简单。而不是移动所有选定的节点(例如
加拿大…法国
在下图上)上位于所有选定项目之前移动所有选定项目之前的第一个节点:i.sstatic.net/9wai1.png“ rel =“ nofollow noreferrer ,在移动所有选定项目之前的节点后(在测试示例中,这是
巴西
item)ultratree
控制将如下如下所示:要正确确定所选项目的限制,应使用
sortByposition()
方法对其进行排序,该方法对selected> selected Nodes
Collection进行分类。成员以在树上的顺序出现。Try the code below:
The logic implemented in the code above is very simple. Instead of moving all selected nodes (for example
Canada…France
on the picture below) up the first node located before all the selected items moving after all selected items down:Therefore, after moving the node preceding all selected items down (in the test example this is
Brazil
item) theUltraTree
control will be look like below:To determine limits of the selected items correctly they are should be sorted by using the
SortByPosition()
method, that sorts theSelectedNodes
collection such that members appear in the same order they do in the tree.