How do you databind to a System.Windows.Forms.Treeview control?

后端 未结 3 1913
[愿得一人]
[愿得一人] 2020-12-01 18:37

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 ca

3条回答
  •  不知归路
    2020-12-01 19:02

    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.

提交回复
热议问题