title: WPF Menu Sub Items
body: <p>Given the following xaml and object structures:</p>
  
  <pre><code>&lt;Menu ItemsSource="{Binding PageViewModels}" MouseEnter="Menu_MouseEnter" DockPanel.Dock="Top"&gt;
              &lt;Menu.ItemTemplate&gt;
                  &lt;HierarchicalDataTemplate ItemsSource="{Binding Value}"&gt;
                      &lt;TextBlock Text="{Binding Key}"&gt;&lt;/TextBlock&gt;
                      &lt;HierarchicalDataTemplate.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;MenuItem Header="{Binding Name}" ItemsSource="{Binding MenuItems}"&gt;
                                  &lt;MenuItem.ItemTemplate&gt;
                                      &lt;HierarchicalDataTemplate ItemsSource="{Binding}"&gt;
                                          &lt;HierarchicalDataTemplate.ItemTemplate&gt;
                                              &lt;DataTemplate&gt;
                                                  &lt;TextBlock Text="{Binding Name}" /&gt;
                                              &lt;/DataTemplate&gt;
                                          &lt;/HierarchicalDataTemplate.ItemTemplate&gt;
                                      &lt;/HierarchicalDataTemplate&gt;
                                  &lt;/MenuItem.ItemTemplate&gt;
                              &lt;/MenuItem&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/HierarchicalDataTemplate.ItemTemplate&gt;
                  &lt;/HierarchicalDataTemplate&gt;
              &lt;/Menu.ItemTemplate&gt;
          &lt;/Menu&gt;
  </code></pre>
  
  <p>And view model object:</p>
  
  <pre><code>Public Class MenuItemViewModel
  
          Private _name As String
          Private _parentName As String
          Private _objType As Type
  
          Public Sub New(name As String, parentName As String, objType As Type)
              _name = name
              _parentName = parentName
              _objType = objType
          End Sub
  
          Public ReadOnly Property Name As String
              Get
                  Return _name
              End Get
          End Property
  
          Public ReadOnly Property ParentName As String
              Get
                  Return _parentName
              End Get
          End Property
  
          Public ReadOnly Property ObjectType As Type
              Get
                  Return _objType
              End Get
          End Property
  
          Public Property MenuItems As New ObservableCollection(Of MenuItemViewModel)
  
      End Class
  
  ...
  
  Public ReadOnly Property PageViewModels As Dictionary(Of String, List(Of MenuItemViewModel))
  </code></pre>
  
  <p>I can't get the menu to display sub items:</p>
  
  <p><img src="https://i.stack.imgur.com/PspBq.png" alt="enter image description here"></p>
  
  <p>I'm sure my xaml is not correct otherwise it would be working so any help is appreciated!</p>