title: How to display context menu for treeview item in a hierarchial data template in wpf
body: <p>How to display context menu for tree view item in wpf using the hierarchical data template? How to display context menu only for CountryTemplate:</p>
  
  <pre><code>  &lt;HierarchicalDataTemplate  x:Key="DispTemplate"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding Path=Label}" Style="{StaticResource TreeTextStyle}" ToolTip="{Binding Path=Description}" Tag="{Binding Path=Tag}"&gt;
              &lt;/TextBlock&gt;
          &lt;/StackPanel&gt;
      &lt;/HierarchicalDataTemplate&gt;
      &lt;HierarchicalDataTemplate  x:Key="BuildingTemplate"  ItemsSource="{Binding Path=Building}" ItemTemplate="{StaticResource BuildingTemplate}"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding Path=Label}" Style="{StaticResource TreeTextStyle}" ToolTip="{Binding Path=Description}"/&gt;
          &lt;/StackPanel&gt;
      &lt;/HierarchicalDataTemplate&gt;
      &lt;HierarchicalDataTemplate  x:Key="CityTemplate"  ItemsSource="{Binding Path=City}" ItemTemplate="{StaticResource CityTemplate}"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding Path=Label}" Style="{StaticResource TreeTextStyle}" ToolTip="{Binding Path=Description}"/&gt;
          &lt;/StackPanel&gt;
      &lt;/HierarchicalDataTemplate&gt;
      &lt;HierarchicalDataTemplate x:Key="CountryTemplate" ItemsSource="{Binding Path=Country}" ItemTemplate="{StaticResource CountryTemplate}"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding Path=RootName}" Style="{StaticResource TreeTextStyle}" ToolTip="{Binding Path=Description}"/&gt;
          &lt;/StackPanel&gt;
      &lt;/HierarchicalDataTemplate&gt;
  </code></pre>