C# XAML (WPF) add button to image -


i have code:

<button >       <button.content>             <image source="component/resources/homer.jpg" />       </button.content> </button> 

this create image part of button want opposite thing, want have image , make button part od image

something like:

<image >      <button>      </button> </image> 

is possible? if yes, how?

thanks you

this not directly possible.

the reason image class designed display image, not host controls, , not implement content or inherit contentcontrol way other hosting objects do.

while there no little reason can fathom not place image in button, there few options.

  • while image not implement click event, can use preview mouse down similar effect.
  • you can place both button , image in grid, causing them share same space
<grid >     <button ... horizontalalignment="stretch" verticalalignment="stretch" />     <image ... /> </grid > 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -