title: WPF get parent of menuItem
body: <p>I don't know how to get the parent of a menuItem? I searched all arround but can't get a good answer...</p>
  
  <p>My XAML is:</p>
  
  <pre><code>&lt;DockPanel&gt;
              &lt;Menu DockPanel.Dock="Right" SnapsToDevicePixels="True" Margin="2,0,0,0"&gt;
                  &lt;MenuItem Header="Devices"&gt;
                      &lt;local:MenuItemWithRadioButton x:Name="MenuItemVideoDevices" Header="Video"&gt;
                      &lt;/local:MenuItemWithRadioButton&gt;
                      &lt;local:MenuItemWithRadioButton x:Name="MenuItemAudioDevices" Header="Audio"&gt;
                      &lt;/local:MenuItemWithRadioButton&gt;
                  &lt;/MenuItem&gt;
              &lt;/Menu&gt;
  &lt;/DockPanel&gt;
  
  private void MenuItemWithRadioButtons_Click(object sender, System.Windows.RoutedEventArgs e)
  {
          MenuItem mi = sender as MenuItem;
          if (mi != null)
          {
              RadioButton rb = mi.Icon as RadioButton;
              if (rb != null)
              {
                  rb.IsChecked = true;
              }
              //Here I want to get the parent menuItem
          }            
  }
  </code></pre>
  
  <p>In the code, when I click the submenuItem like "MenuItemVideoDevices", an event process function is triggered, but I don't know how to get the menuItem "Video" in this function.</p>
  
  <p>Anyone knows? </p>