title: C# WPF ListView keyboad and Mouse Selection
body: <p>I have a simple listview control. I am using the SelectedIndex binding to change the selection programmatically and its working fine.</p>
  
  <pre><code>SelectedIndex="{Binding SelectedSearchIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectionChanged="OnSelectionChanged"
  </code></pre>
  
  <p>I am also using the following trigger for mouseover selection.</p>
  
  <pre><code> &lt;ListView.ItemContainerStyle&gt;
       &lt;Style TargetType="{x:Type ListViewItem}"&gt;
            &lt;Setter Property="Focusable" Value="False"/&gt;
            &lt;Style.Triggers&gt;
                &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                    &lt;Setter Property="IsSelected" Value="True"/&gt;
                &lt;/Trigger&gt;
             &lt;/Style.Triggers&gt;
        &lt;/Style&gt;
   &lt;/ListView.ItemContainerStyle&gt;
  </code></pre>
  
  <p>The issue I am facing is the after making a selection programmatically(listviewitem 1) if I do a mouse selection (listviewitem 5) I see 2 selections (listviewitem 1 and listviewitem 5) in the list view. I just want a single selection i.e when the mouse selection happens the programmatic selection to disappear. Also one thing I observed is that on mouseover selection the selectionchange event is firing but the selectedindex is not getting updated it remains to be the index that was set programmatically is this the correct behavior .</p>