#680 – IsHitTestVisible Applies to All Child Elements

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>

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #680 – IsHitTestVisible Applies to All Child Elements

  1. Mohamed says:

    yeah, I found that out today 😦

Leave a comment