1 <Window x:Class="Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="HierarchicalDataTemplate Sample"
5 xmlns:src="clr-namespace:HierarchicalDataTemplate_VB">
8 <src:ListLeagueList x:Key="MyList"/>
10 <HierarchicalDataTemplate DataType="{x:Type src:League}"
11 ItemsSource="{Binding Path=Divisions}">
12 <TextBlock Text="{Binding Path=Name}"/>
13 </HierarchicalDataTemplate>
15 <HierarchicalDataTemplate DataType="{x:Type src:Division}"
16 ItemsSource="{Binding Path=Teams}">
17 <TextBlock Text="{Binding Path=Name}"/>
18 </HierarchicalDataTemplate>
20 <DataTemplate DataType="{x:Type src:Team}">
21 <TextBlock Text="{Binding Path=Name}"/>
23 </DockPanel.Resources>
25 <Menu Name="menu1" DockPanel.Dock="Top" Margin="10,10,10,10">
26 <MenuItem Header="My Soccer Leagues"
27 ItemsSource="{Binding Source={StaticResource MyList}}" />
31 <TreeViewItem ItemsSource="{Binding Source={StaticResource MyList}}"
32 Header="My Soccer Leagues" />