#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>

Advertisement

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: