#680 – IsHitTestVisible Applies to All Child Elements
October 31, 2012 1 Comment
If you set the IsHitTestVisible property of a container element to false, it will turn off hit testing for all elements within that container.
Even if a child element sets its own IsHitTestVisible property to true, it will still be hidden from hit testing. The false value set at the container level applies to all child elements, no matter what value they set.
<StackPanel IsHitTestVisible="False"> <Button Content="You can't Click this" HorizontalAlignment="Center" Margin="5" Click="Button_Click_1"/> <Button Content="You can't even Click this" HorizontalAlignment="Center" Margin="5" Click="Button_Click_2" IsHitTestVisible="True"/> </StackPanel>