展开所有节点后,将焦点设置在Treeview根节点上 [英] Set focus on the Treeview root node after expanding all nodes

查看:181
本文介绍了展开所有节点后,将焦点设置在Treeview根节点上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我填充并展开TreeView中的所有节点后,焦点位于Treeview的底部.但是,在扩展所有节点之后,如何将焦点设置在Treeview的顶部根节点上?请帮忙.
在此先感谢.

After I populate and expand all the nodes in the TreeView the focus is at the bottom of the Treeview. But how do I set the focus on the top root node of the Treeview after expanding all the nodes? Please Help.
Thanks in advance.

推荐答案

焦点"是一个错误的术语.节点没有焦点(控件具有焦点).只能选择或不选择节点.因此,请看与选择有关的方法.例如,使用System.Windows.Forms.TreeView.SelectedNode读/写属性.

这是用于表格.自己为其他UI库做这个简单的练习:
http://msdn.microsoft.com/en-us/library/system. windows.forms.treeview.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. windows.controls.treeview.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.aspx [ ^ ].

您需要那些TreeView控件中的哪一个?

为什么不标记要使用的UI库?永远做!我们无法读懂你的想法.
如果这样做,您将得到确切的答案.

—SA
"Focus" is a wrong term. Nodes do not have focus (a control has). A node can only be selected or not. So, look at the methods related to selection. For example, use System.Windows.Forms.TreeView.SelectedNode read/write property.

This is for Forms. Do this simple exercise by yourself for other UI libraries:
http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.treeview.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.aspx[^].

Which one of those TreeView controls do you need?

Why didn''t you tag the UI library you want to use? Always do it! We cannot read your mind.
If you did, you would get exact answer.

—SA


这篇关于展开所有节点后,将焦点设置在Treeview根节点上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆