如何右键单击树视图控件中选择节点
为什么我右键单击树视图中的节点,焦点会移至该节点,然后立即返回到先前选择的节点。有什么方法可以允许右键单击选择节点吗?
Why I right click on a node in my treeview the focus moves to this node and then immediately back to the previously selected node. Is there some way that I can allow the right click to select the node?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是因为突出显示颜色执行两个职责,它显示选定的节点和显示聚焦的节点。如果您不对右键单击事件执行任何操作,则会跳回到所选节点。解决方法是选择节点:
加上您想要执行的任何其他操作,通常显示上下文菜单。
That's because the highlight color performs two duties, it shows the selected node and shows the focused node. If you don't do anything with the right-click event then it jumps back to the selected node. The workaround is to select the node:
Plus anything else you want to do, usually displaying a context menu.
抱歉,我有点操之过急,我发现如何做到这一点如下:
控件不应该按照标准执行此操作吗?
Apologies I jumped the gun slightly I found how to do this as follows:
Shouldn't the control do this as standard though?