TreeView-父节点和子节点 [英] TreeView - Parent Nodes and Child Nodes

查看:88
本文介绍了TreeView-父节点和子节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我不知道该怎么做.

我有一个树状视图,我希望当我选择一个子节点时,父节点会自动显示为选中状态.

我尝试了事件:" SelectedNodeChanged ",但是它不起作用.

我希望有人能给出答案.

非常感谢.

Hi everyone!!

I don´t know how to do this.

I have a treeview, and I want that when I select a child node, automatically the parent node appear selected.

I try the event: "SelectedNodeChanged" but it doesn´t work.

I hope that someone has the answer.

Thank you very much.

推荐答案

通常,所有树视图的UI范例都假定用户一次在节点上选择.它看起来非常自然和清晰,并且多重选择模式会造成混淆.因此,我的建议是不要尝试创建这种树视图样式.

但是,如果您确实想要这样的东西,可以找到一些解决方案.首先,人们通常使用检查而不是选择.例如,请参见:
http://stackoverflow. com/questions/7158876/multiple-selection-tree-view-control-for-asp-net-web-application-using-c-net [具有多项选择的C#TreeView [ C#中的多选TreeView控件 [ http://bit.ly/xbvqur [
Normally, the UI paradigm of all tree views assumes that the user selects on node at a time. It looks very natural and clear, and multiple selection mode would be confusing. So, my advise would be not trying to create such tree view style.

However, if you really want something like that, you can find some solution. First of all, people usually use checking instead of selection. For example, see this:
http://stackoverflow.com/questions/7158876/multiple-selection-tree-view-control-for-asp-net-web-application-using-c-net[^].

Moreover, as this is a Web application; and tree view is not a native HTML element; instead, ASP.NET generates a tree view based on other HTML elements. So, you can create a different tree view class to develop a very different tree view style; or you can customize available tree view. Please see these CodeProject articles:
C# TreeView with multiple selection[^],
Multi-Select TreeView Control in C#[^].

If you want, you can probably find some more: http://bit.ly/xbvqur[^].

—SA


这篇关于TreeView-父节点和子节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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