How do I set custom Button backgrounds for all the states?


  • I want to use my own bitmaps for my buttons.  I can set the background brush for a button to my own ImageBrush and that works fine, except for the hover and pressed states.  I cannot figure out how to set the bitmaps for them.  Can someone enlighten me?


    Thursday, July 05, 2012 12:09 AM

All replies

  • Hi,

    Yes, the addition style is added by system, you need  more code to remove it.

    If you don't want the hover style, you can use a image control and add the click event.

    In addition, you can create a custom control in metro. Please follow this sample code

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, July 06, 2012 8:19 AM
  • Thanks for the reply.  I have actually already gone the custom control route, but why was that necessary?  Why is there not a simple way to set the bitmaps for all the states?  I mean, why do you even let me change the normal state bitmap if I cannot change the others.  I DO want the hover and pressed styles, but I want the ability to control how they look.  What are the chances that I would want to change the look of the normal state of the button but would be happy with the default look of the other states? 

    I write apps for both Android and iOS and in both these cases, it is a simple matter to skin the buttons.  I'm sorry, but the more I use Metro, the more I feel that it is simply 'not finished'.

    Friday, July 06, 2012 11:12 PM
  • I'm just learning how ImageBrushes work today, but I think you can create four ImageBrushes, and then change the background using the VisualStateManager for the button's template.  Do you happen to know how to get ImageBrushes to tile?

    Andrea Mantler

    Tuesday, August 06, 2013 8:17 PM