Waterfr Villa
Waterfr Villa

Reputation: 1317

Create an image button where the size of button is determine by enclosed image in wpf

I would like to create an image button where width and height of the button to be the same as of those of the image so that all we see is the image not the button. How can i do that?

PS. the reason that I am enclosing an image inside a button is that images are not focus-able I want to focus on an image by pressing tab key, but tab key just skips images

Upvotes: 0

Views: 31

Answers (1)

Spawn
Spawn

Reputation: 935

Image control has Focusable property...

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Image Grid.Row="0" Source="img1.png" Focusable="True" />
    <Image Grid.Row="1" Source="img2.png" Focusable="True" />
</Grid>

Tab key works great.

Upvotes: 2

Related Questions