I have been fighting this thing for too long now. I am just not getting this apparently. Can someone tell me what I am doing wrong with the xaml that is causing the second level to not show.
Here is the code.
XAML
<TreeView Margin="0,0,0,0" ItemsSource="{Binding Path=Configuration.Servers}"><TreeView.ItemTemplate><HierarchicalDataTemplate ItemsSource="{Binding Path=Reports}" DataType="{x:Type utils:CMSServer}"><TextBlock Text="{Binding Path=Name}"/><HierarchicalDataTemplate.ItemTemplate><DataTemplate DataType="{x:Type utils:CMSReport}"><TextBlock Text="{Binding Path=Name}"/></DataTemplate></HierarchicalDataTemplate.ItemTemplate></HierarchicalDataTemplate></TreeView.ItemTemplate></TreeView>
Here is the underlying class
C#:
public class ConfigViewClass { private ObservableCollection<CMSServer> _servers; private string _key; public ConfigViewClass () { _servers = new ObservableCollection<CMSServer>(); }//constructor public ObservableCollection<CMSServer> Servers { get { return _servers; } set { _servers = value; } } public string Key { get { return _key; } set { _key = value; } } }//Configuration View public class CMSServer { public ObservableCollection<CMSReport> Reports { get; set; } public string Name { get; set; } public CMSServer () { Reports = new ObservableCollection<CMSReport>(); }//constructor }//CMS Server Class public class CMSReport { public string Name { get; set; } public CMSReport () { } }//CMS Reports
Greatly appreciate someone pointing out, what is sure to be a stupid mistake, for me.