title: ListBoxItem index on ListBox mouseover
body: <p>I have a <code>ListBox</code> in a WPF application that has a <code>MouseMove</code> event handler attached. What I would like to do is to use this event to get the index of the item the mouse is over.</p>
  
  <p>Simplified example of my code:</p>
  
  <pre><code>&lt;StackPanel&gt;
      &lt;ListBox x:Name="MyList" MouseMove="OnMouseMove"/&gt;
      &lt;Separator/&gt;
      &lt;Button&gt;Beep&lt;/Button&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  
  
  <pre><code>public CodeBehindConstructor()
  {
     List&lt;string&gt; list = new List&lt;string&gt;();
     list.Add("Hello");
     list.Add("World");
     list.Add("World"); //Added because my data does have duplicates like this
  
     MyList.ItemsSource = list;
  }
  
  public void OnMouseMove(object sender, MouseEventArgs e)
  {
     //Code to find the item the mouse is over
  }
  </code></pre>