most of the found (so far) articles about using WPF with MVVM pattern, describe binding TreeView to tree of same elements, e.g. http://www.codeproject.com/Articles/26288/Simplifying-the-WPF-TreeView-by-Using-the-ViewMode.
in those tutorials, there is only a single class, which contains children of the same type, such as class "person" which has parents and children. TreeView uses HierarchicalDataTemplate, to bind to a single class.
what if there are a selection of different classes, which build a tree. as an example consider such xml:
<a x=1>
<b x=2>
<c x=3 />
<c x=3 />
</b>
</a>
so each xml element is wrapped into a different class: classes A, B and C.
how to properly write XAML to bind those?
in order to show first 2 layers below XAML is suited:
<TreeView ItemsSource="{Binding As}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Bs}">
<TreeViewItem>
<TreeViewItem.Header>
<TextBlock Text="{Binding x}" />
</TreeViewItem.Header>
</TreeViewItem>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
but how to include 3rd layer, namely C?