title: Adding MouseBindings to Items in a databound WPF ListView
body: <p>I'm trying to get a command in my ViewModel executed when the user clicks on a item in a ListView. When I add a <code>ListViewItem</code> in XAML I can just add a <code>MouseBinding</code> to its <code>InputBindings</code>.</p>
  
  <pre><code>&lt;ListView&gt;
  &lt;ListView.View&gt;
     &lt;GridView&gt;
        &lt;GridViewColumn Header="Test" /&gt;
     &lt;/GridView&gt;
     &lt;/ListView.View&gt;
     &lt;ListViewItem Content="Item 1" &gt;
        &lt;ListViewItem.InputBindings&gt;
           &lt;MouseBinding Gesture="LeftDoubleClick" Command="{Binding DoubleClickCommand}" /&gt;
        &lt;/ListViewItem.InputBindings&gt;
   &lt;/ListViewItem&gt;
   &lt;/ListView&gt;
  </code></pre>
  
  <p>But how can this be achived in a databound ListView?</p>
  
  <pre><code>&lt;ListView ItemsSource="{Binding Patients}"&gt;
  &lt;ListView.View&gt;
      &lt;GridView&gt;
          &lt;GridViewColumn Header="Test" /&gt;
      &lt;/GridView&gt;
      &lt;!-- How to set the MouseBinding for the generated ListViewItems?? --&gt;
  &lt;/ListView.View&gt;
  </code></pre>
  
  <p></p>
  
  <p>I already got a solution by defining <code>ListViewItem</code> style and replacing the <code>ControlTempalte</code> of the <code>ListViewItem</code>. Though, I hope there is an easier solution.</p>
  
  <p>Sincerely,
  Michael</p>