I Have this code:
<Button >
<Button.Content>
<Image Source="component/Resources/Homer.jpg" />
</Button.Content>
</Button>
This create an image as part of a button But i want to do the opposite thing, i want to have an image and make a button a part od that image
something like:
<Image >
<Button>
</Button>
</Image>
Is it possible? if yes, how?
Thanks you
This is not directly possible.
The reason is that the Image Class is designed to display an image, not host controls, and thus does not implement a content or inherit from ContentControl the way other hosting objects do.
While there no little reason I can fathom NOT to place an Image in a Button, there are a few options.
<Grid > <Button ... HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <Image ... /> </Grid >
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.