Total XAML noob here. I’m having problems determining the proper way to change the background color on a Button element for the pressed state. It seems the default button background is white. How do I make it some other color (with transparency). Code snippet would be very helpful.
Total XAML noob here. I’m having problems determining the proper way to change the
Share
The default template for Button uses a resource for the Pressed state’s Background named “ButtonPressedBackgroundThemeBrush”. If you want this to change for all Buttons in your application you can override this in your App.xaml resources by adding a Brush using the same key. Here’s an example using solid red:
If you only want a single Button to use a different Background you can override the Template. The easiest way is to use Blend and right-click the Button, and select Edit Template->Edit a Copy. This will generate a copy of the XAML for you and you can either use the States tab or edit the XAML for the Pressed state by hand.