title: Wpf TreeView Get Item from ContextMenu
body: <p>Hi 
  I got the following Treeview, with a ContextMenu with the following MenuItems DoSomeThingOnItem and DoAnotherThingOnItem.</p>
  
  <p>But what do I need to do, for me to get the Item, where the contextmenuitem was clicked?</p>
  
  <pre><code>&lt;TreeView Name="treeView1" ItemsSource="{Binding Regions}"  AllowDrop="True" PreviewMouseRightButtonDown="TreeView1PreviewMouseRightButtonDown"&gt;
              &lt;TreeView.ItemContainerStyle&gt;
                  &lt;!-- This Style binds a TreeViewItem to a TreeViewItemViewModel.--&gt;
                  &lt;Style TargetType="{x:Type TreeViewItem}"&gt;
                      &lt;Setter Property="AllowDrop" Value="True" /&gt;
                      &lt;Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/&gt;
                      &lt;Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/&gt;
                      &lt;Setter Property="FontWeight" Value="Normal"/&gt;
                      &lt;Style.Triggers&gt;
                          &lt;Trigger Property="IsSelected" Value="True"&gt;
                              &lt;Setter Property="FontWeight" Value="Bold"/&gt;
                          &lt;/Trigger&gt;
                      &lt;/Style.Triggers&gt;
                  &lt;/Style&gt;
              &lt;/TreeView.ItemContainerStyle&gt;
              &lt;TreeView.Resources&gt;
                  &lt;/HierarchicalDataTemplate&gt;
                  &lt;HierarchicalDataTemplate DataType="{x:Type ViewModel:ProductViewModel}"
                                            ItemsSource="{Binding Children}"&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;Image Width="16" Height="16" Margin=" 3,0" Source="Images\item.png"/&gt;
                          &lt;TextBlock Text="{Binding Name}"&gt;&lt;/TextBlock&gt;
                          &lt;StackPanel.ContextMenu&gt;
                              &lt;ContextMenu&gt;
                                  &lt;MenuItem Header="DoSomeThingOnItem"&gt;&lt;/MenuItem&gt;
                                  &lt;MenuItem Header="DoAnotherThingOnItem"&gt;&lt;/MenuItem&gt;
                              &lt;/ContextMenu&gt;
                          &lt;/StackPanel.ContextMenu&gt;
                      &lt;/StackPanel&gt;
  
                  &lt;/HierarchicalDataTemplate&gt;
  
              &lt;/TreeView.Resources&gt;
          &lt;/TreeView&gt;
  </code></pre>
  
  <p>Just to make it more clear, here is my contextmenu</p>
  
  <pre><code> &lt;ContextMenu&gt;
     &lt;MenuItem Header="DoSomeThingOnItem"&gt;&lt;/MenuItem&gt;
     &lt;MenuItem Header="DoAnotherThingOnItem"&gt;&lt;/MenuItem&gt;
   &lt;/ContextMenu&gt;
  </code></pre>
  
  <p>I have already tried with the Click event, but It just gives me a </p>
  
  <pre><code>MenuItem contextMenuItem = (MenuItem)sender;
  </code></pre>
  
  <p>And I can't figure out a way to get the item from that.</p>