你可以数据绑定一个TreeView控件吗? [英] Can you data bind a TreeView control?

查看:105
本文介绍了你可以数据绑定一个TreeView控件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当我使用C#/ VB附带的标准TreeView控件时,我写自己的方法将数据传入和传出Tree的内部层次结构存储。



可能有方法将GUI绑定到我可以指向的数据存储(如XML文件),当用户编辑树项目时,应将其保存回存储。有没有办法这样做?

解决方案

以下文章应该让你做你想要的。

http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx



编辑:如果您不需要与上述相同的详细信息,则
以下可能更容易/更合适:
http://www.codeproject.com/KB/tree /dbTree.aspx



编辑2:
看到您想要响应树视图中的更改,你可能想要第一个选项。


Typically, when I use the standard TreeView control that comes with C#/VB I write my own methods to transfer data in and out of the Tree's internal hierarchy store.

There might be ways to "bind" the GUI to a data store that I can point to (such as XML files), and when the user edits the tree items, it should save it back into the store. Is there any way to do this?

解决方案

The following article should let you do what you want.
http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx

Edit: If you don't need something quite as elaborate as the above, the following might be easier/more appropriate: http://www.codeproject.com/KB/tree/dbTree.aspx

Edit 2: Seeing as you want this to respond to changes in the treeview, you'll probably want the first option.

这篇关于你可以数据绑定一个TreeView控件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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