I have a class :
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
this class contains metadata about each item and a list of it’s sons , How to bind this class to WPF Treeview controller ? , and when item selected How can I access it’s metadata ?
Thanks for Help.
To bind to the nested collection of objects to your treeView you need to define a
Hierarchical DataTemplatealong withDataTemplatein your view. If it’s something new to you, these links might be helpful to you –WPF TreeView binding and Binding with treeView or let a search engine do the honours for you – Search for Binding to treeView in WPF