title: Two way binding of IsChecked within a nested MenuItem
body: <p>I have a nested context menu like this:</p>
  
  <pre><code>&lt;ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}"&gt;
      &lt;MenuItem Header="Thing Count" ItemsSource="{Binding ThingsProvider}"&gt;
  </code></pre>
  
  <p>NB the Thing Count parent MenuItem with children from ThingsProvider.</p>
  
  <p>ThingsProvider provides a List of ThingViewModel which contains properties Thing and IsChecked. I want to be able to control IsChecked from my main view model and from the user via the MenuItem but I have hit a problem; If I use an ItemContainerStyle like this.</p>
  
  <pre><code>    &lt;MenuItem.ItemContainerStyle&gt;
          &lt;Style TargetType="MenuItem"&gt;
              &lt;Setter Property="Header" Value="{Binding Path=Thing, Mode=OneWay}"/&gt;
              &lt;Setter Property="IsChecked" Value="{Binding Path=IsChecked, UpdateSourceTrigger=PropertyChanged}"/&gt;
          &lt;/Style&gt;
      &lt;/MenuItem.ItemContainerStyle&gt;
  </code></pre>
  
  <p>then (predictably I suppose as it's a style) it will observe the ViewModel's IsChecked but will not set it.</p>
  
  <p>If I use an ItemTemplate like so</p>
  
  <pre><code>&lt;MenuItem.ItemTemplate&gt;
    &lt;DataTemplate&gt;
      &lt;TextBlock Text="{Binding Path=Thing, Mode=OneWay}"/&gt;
    &lt;/DataTemplate&gt;
   &lt;/MenuItem.ItemTemplate&gt;
  </code></pre>
  
  <p>I can't get to the MenuItem's IsChecked property as I've only got the TextBlock. If I put a MenuItem in the ItemTemplate then I end up with nested MenuItems in my UI and it looks bad.</p>
  
  <p>There must be a way to do this but I'm stumped at the moment, can anyone help?</p>
  
  <p>Cheers</p>
  
  <p>Rich</p>