Can you data bind a TreeView control?

2019-04-08 09:47发布

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?

1条回答
冷血范
2楼-- · 2019-04-08 10:20

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.

查看更多
登录 后发表回答