Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm looking at this control, and it seems to be lacking the standard .net "datasource" and "datamember" properties for databinding. Is this control not bindable? I can write some custom function that populates the treeview from a given data source, I suppose, and embed data objects as necessary, but is that the 'best practice'? Or does everyone simply use a 3rd party treeview control?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
519 views
Welcome To Ask or Share your Answers For Others

1 Answer

You are correct in that there is no data binding. The reason being is that TreeViews are hierarchical data structures. That is, not a straight list. As a result the databind option is invalid to say a List structure.

Sadly it's creating your own populate methods or buying 3rd party controls (which in the end will have their own populate methods.)

Here's a decent MSDN article on Binding Hierarchical Data.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...