Page 1 of 1
VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?
Posted: 13 Oct 2017, 02:51
by nikobarli
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.
Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?
Posted: 15 Oct 2017, 20:43
by sfernandez
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.
Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?
Posted: 17 Oct 2017, 02:33
by nikobarli
Great. I am able to bypass the element with IsHitTestVisible=false using the delegate version of HitTest.
Thanks.
Re: VisualTreeHelper::HitTest doesn't check for IsHitTestVisible property ?
Posted: 18 Oct 2017, 00:03
by sfernandez
Ok, marked this as solved.