title: Detect Children Controls under mouse in WPF
body: <p>I have a WPF <code>ParentUserControl</code> and some <code>ChildUserControlA</code> <code>ChildUserControlB</code> etc. (also WPF controls)</p>
  
  <p>The <code>ChildUserControl</code>s are controls containing on them some other basic elements (textboxes, labels, etc)</p>
  
  <p>In the main form's status bar I need to display the name of the currenlty mouse overed <em>ChildUserControl</em>.</p>
  
  <p>So, in the <em>ParentUserControl</em>'s MouseMove I obtain an object <code>myElement = Mouse.DirectlyOver</code> because I need the top most of <strong>ChildUserControl</strong>'s, but I obtain instead a 'System.Windows.Controls.TextBlock' (part of ChildUserControl)...</p>
  
  <p>How to fix that? </p>
  
  <p>I need when I mouseOver an MyChildControl that the MyChildControl be detected, and not its child elements.</p>
  
  <p>In this order I used on MyChildControl the following:</p>
  
  <pre><code>Protected Overrides Function HitTestCore(
                      hitTestParameters As PointHitTestParameters) As HitTestResult
  
      Return New PointHitTestResult(Me, hitTestParameters.HitPoint)
  End Function
  </code></pre>
  
  <p>but anyway I get sometimes the textblock as result, sometimes the ChildUserControl...</p>