WPF Heirachical DataTemplate in TreeView
问题 I am trying to get my head around Heirarchical DataTemplates and TreeViews in WPF and am having some trouble. I have created an app with only a TreeView on the form as below and defined HierarchicalDataTemplate's for both a Directory object and a File object I then Bind the TreeView to the Directories property (ObservableCollection) of my model. <Grid> <Grid.Resources> <HierarchicalDataTemplate DataType="{x:Type local:Directory}" ItemsSource ="{Binding Directories}"> <TextBlock Text="{Binding