Hit testing in WPF

I have Ellipse on Canvas and I am doing Hit Testing on it. Every time I click the Ellipse move, the test passes. If I click in the middle of Ellipse , the test will fail. It's good!

After filling the ellipse as follows: myEllipse.Fill = new SolidColorBrush(Colors.Blue); , test pasess also when I click in the middle of Ellipse .

How can I disable this? (even if the Ellipse fill is filled, the test will fail when I click in the middle) Thanks!

+7
c # wpf graphics hittest
source share
2 answers

If you do your own testing for testing purposes (see Visual Layer hit testing for details on how to do this), you should be able to test IntersectionDetail GeometryHitTestResult IntersectionDetail.Intersects , not IntersectionDetail.FullyContains .

+8
source share

Can you put a smaller ellipse in the middle and set IsHitTestVisible = "false"?

0
source share

All Articles