<ItemsControl ItemsSource="{Binding Path=CollegeViewModel}"> <ItemsControl.ItemTemplate> <HierarchicalDataTemplate> <StackPanel> <Label Content="{Binding Path=DisplayText}"/> <TreeView ItemsSource="{Binding Path=Children}"> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type common:StudentItem}" ItemsSource="{Binding Path=Children}"> <TextBlock Text="{Binding Path=DisplayText}"/> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type common:TeacherItem}" ItemsSource="{Binding Path=Children}"> <TextBlock Text="{Binding Path=DisplayText}"/> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type common:LecturerItem}" ItemsSource="{Binding Path=Children}"> <TextBlock Text="{Binding Path=DisplayText}" /> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type common:Leaf}"> <ListBox ItemsSource="{Binding Children}" > <ListBox.ContextMenu> <ContextMenu> <MenuItem Header="QuickView" Command="{Binding ExitCommand}"/> </ContextMenu> </ListBox.ContextMenu> </ListBox> </DataTemplate> </TreeView.Resources> </TreeView> </StackPanel> </HierarchicalDataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)