title: Get reference to an item in a HeaderedItemsControl
body: <p>XAML:</p>
  
  <pre><code>&lt;HeaderedItemsControl ItemsSource="{Binding FooCollection}"&gt;
  &lt;HeaderedItemsControl.ItemTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;StackPanel&gt;
              &lt;TextBlock Text={Binding foo}/&gt;
              &lt;Button Command="{Binding DeleteFoo}"&gt;Delete&lt;/Button&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/HeaderedItemsControl.ItemTemplate&gt;
  </code></pre>
  
  <p>Given this XAML, how can I get a reference to the item clicked in FooCollection, in the DeleteFoo command &amp; method, in the ViewModel? Normally in a DataGrid etc, it would just be the SelectedItem bound in your ViewModel, but annoyingly the HeaderedItemsControl doesn't have this option. </p>
  
  <p>Is there another way to pass a reference to the item, or its index position in FooCollection via CommandArguments for example? </p>
  
  <p>I realise that the ListView is a similar control, that has a selectedItem equivalent, however I've got a nicely formatted HeaderedItemsControl set up (with a title header) so I'd prefer to not have to ditch that if possible.</p>
  
  <p>Thanks very much in advance for any help.</p>