Reputation: 9903
Is there a way to get the element at the mouse position?
I am using Mouse.DirectlyOver.
It works fine only if the mouse is not captured. If the mouse is captured, it gets the element with mouse capture which is not necessarily the element at mouse position. In fact, the MSDN documentation says :
If an element has mouse capture, the mouse pointer is considered directly over the element regardless of the where the mouse pointer is.
Is there a workaround?
Upvotes: 2
Views: 8715
Reputation: 29083
Perform a hittest http://msdn.microsoft.com/en-us/library/ms608753.aspx. Use your window as the 'reference' parameter and pass in a PointHitTestParameters object. For that object, set the point with Mouse.GetPosition( yourWindow )
Upvotes: 2