nikobarli
Topic Author
Posts: 180
Joined: 26 Apr 2017, 06:23

VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?

13 Oct 2017, 02:51

So I have a border element with its IsHitTestVisible property is set to False.
        <Border BorderThickness="10" BorderBrush="Red" IsHitTestVisible="False" Visibility="True">
        </Border>
However, when I performed VisualTreeHelper::HitTest on top of it, the border is returned as the hit element.

Is it a bug ? Thanks.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?

15 Oct 2017, 20:43

It is not a bug, we are following the same behavior as WPF. It was strange for me also, but it is correct.
The property IsHitTestVisible is only used to generate Mouse events.

You can use the delegate version of HitTest if you need to skip elements with IsHitTestVisible=False.
 
nikobarli
Topic Author
Posts: 180
Joined: 26 Apr 2017, 06:23

Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?

17 Oct 2017, 02:33

Great. I am able to bypass the element with IsHitTestVisible=false using the delegate version of HitTest.

Thanks.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?

18 Oct 2017, 00:03

Ok, marked this as solved.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 87 guests