Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug UIElement.HitTest behavior
3 replies. Latest Post by Yi-Lun Luo - MSFT on May 1, 2008.
(0)
NDRiley
Member
21 points
13 Posts
04-29-2008 8:51 PM |
HitTest only appears to work for me using screen coordinates rather than local coordinates (unlike VisualTreeHelper.HitTest). Based on the documentation, this doesn't seem to be the expected behavior. Can anyone please confirm this is a bug?
Yi-Lun L...
All-Star
25052 points
2,747 Posts
05-01-2008 4:43 AM |
Hello, this is by design. In which document do you find this is not the expected behavior? Here're some comments from our developer team:
For the Rect case, this brings a problem. If our UIElment has say a 45deg rotation, then our Rect in VisualRoot space becomes a trapezoid/rhombus - and the problem with that is that the Rect hittesting code assumes an axis aligned rectangle.
05-01-2008 7:31 PM |
I was referring to the Point case, I would’ve been more specific, but since WPF doesn’t have a Rect HitTest, I didn’t notice that Silverlight did. (Is Silverlight still intended to be a subset of WPF?)
Anyway, I take the reference below as meaning the coordinate system of UIElement.
05-01-2008 11:29 PM |
Well, the document is quite unclear. Actually the coordinate system it talks about should be the global coordinate system. That is the desired behavior. You can easily obtain the point in the global coordinate system.
e.GetPosition(rootElement);