nonocast
nonocast

Reputation: 527

Howto overlay a image on grid?

I want to overlay a image on grid. the code like this:

<Grid>
<UniformGrid>
    <control:ImageButton Width="150" Height="150" Image="/MyStyle;component/Resources/Button1.png" Tag="Playlists" Click="Button_Click" />
    <control:ImageButton Width="150" Height="150" Image="/MyStyle;component/Resources/Button2.png" Tag="Now Playing" Click="Button_Click" />
    <control:ImageButton Width="150" Height="150" Image="/MyStyle;component/Resources/Button3.png" Tag="Artists" Click="Button_Click" />
    <control:ImageButton Width="150" Height="150" Image="/MyStyle;component/Resources/Button4.png" Tag="Genius Mixes" Click="Button_Click" />
</UniformGrid>
<Border>
    <Border.Background>
        <ImageBrush ImageSource="/MyStyle;component/Resources/reflect.png" />
    </Border.Background>
</Border>

the question is, the button cannot get any messages, how can solve this problem?
any idea? thanks.

Upvotes: 2

Views: 356

Answers (1)

Pavlo Glazkov
Pavlo Glazkov

Reputation: 20746

You need to set IsHitTestVisible to false on your overlay element:

<Border IsHitTestVisible="False">
    <Border.Background>
        <ImageBrush ImageSource="/MyStyle;component/Resources/reflect.png" />
    </Border.Background>
</Border>

Upvotes: 2

Related Questions