0

我有一堂课:

Public Class treeModel

    Public Property title As String
    Public Property type As String
    Public Property id As String
    Public Property items As List(Of treeModel) 'Sons

End Class

此类包含有关每个项目的元数据及其儿子的列表,如何将此类绑定到 WPF Treeview 控制器?,以及何时选择项目我如何访问它的元数据?

感谢帮助。

4

1 回答 1

2

要将嵌套的对象集合绑定到您的 treeView,您需要在视图中定义一个Hierarchical DataTemplatewith DataTemplate。如果这对您来说是新事物,这些链接可能对您有所帮助 -

WPF TreeView binding and Binding with treeView or let a search engine do the honor of for you - Search for Binding to treeView in WPF

于 2012-07-21T20:32:29.837 回答