Image fill the space on the button in WPF

后端 未结 4 1593

I have Button on my WPF app and I want an Image to fill the Button completely. Currently I have The following code and it does not fil

4条回答
  •  抹茶落季
    2021-01-20 06:25

    The solution with the Button.Background worked for me only in the vertical direction (the button was shown as a 3 pixel wide vertical slice), because I needed to fit the refresh button on the right side into a horizontal Grid container as shown in this screenshot:

    So, I ended up binding the Width to the ActualHeight property and everthing's looking good to me:

    
    

    The resource I used is an ICO file so the image should be looking good in different sizes and imaging should still be very fast...

提交回复
热议问题