I have a object of a class defined below
class XYZ
{
List<XYZ> child;
String header;
}
I want to bind this object to a tree view. Initially XYZ root will be the topmost TreeViewItem. root will have the List child as the sub TreeViewItems. This will go on recursively until List of each XYZ object is not empty. Each TreeViewItem is either a node or a leaf (if List child is empty).
I am able to do this programmatically by adding TreeViewItem as a child to parent TreeViewItem.
The number of levels is not known.
I referred this answer Bind Object to WPF TreeView but here it is mentioned for a three level hierachy.