title: FindElementsInHostCoordinates Relative To Control Space Not Entire Page
body: <p>I'm using the VisualTreeHelper method FindElementsInHostCoordinates  to find a ListBoxItem at the given X and Y location.  However, X and Y value appear to be related to points in the entire page not just the ListBox I'm interested in (even though I'm passing in that element into the subtree parameter of the method). Below, this refers to a custom control which derives from ListBox.</p>
  
  <pre><code>foreach (UIElement element in VisualTreeHelper.FindElementsInHostCoordinates(new Point(X, Y), this))
  {
      if (element is ListBoxItem)
      {
          int index = this.ItemContainerGenerator.IndexFromContainer(element);
          break;
      }
  }
  </code></pre>
  
  <p>So, (0,0) would be relative to the top left corner of the entire plug-in not the top left corner of the ListBox.  Do I need to do some mathematical work here myself (in code) to transform the page coordinates to the ListBox coordinates or is there some other way to do a hit test to tell if a given X and Y point is over a ListBoxItem?</p>
  
  <p>Thanks.</p>