title: Multiple ListBoxes binding their SelectedItem to the same property in ViewModel - better way?
body: <p>I have a WPF listview, and in one column the cell may contain one or more ListBoxes.</p>
  
  <p>When I right-click a ListBox I'm building a context menu where each item has a DelegateCommand. Currently I'm setting the command parameter to a SelectedListBox property on the page viewmodel itself as my delegate command needs to know which ListBox has been right-clicked.</p>
  
  <p>However this is leading to weird behaviour, which I'm assuming is because I'm binding multiple ListBoxes to the same page-level property (SelectedListBox).</p>
  
  <p>The relevant XAML for the cell template for the listview is as follows:</p>
  
  <pre><code>&lt;DataTemplate x:Key="MultipleListBoxCellTemplate"&gt;
      &lt;ListBox SelectedItem="{Binding Path=DataContext.SelectedListBox, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Page}}}" /&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Is there a better way to get which ListBox has been right-clicked to my viewmodel, or can anyone think of another approach? Much appreciated :)</p>