Overriding a TargetType Style without a Key in WPF
I have been doing a lot of work in WPF lately, and it is a different animal.
The default styles of a button did not look right for my application, so I came up with the following XAML that styles up all of the button objects in my application:
As you can see, I am using TemplateBinding to bind to the desired background color.
However, in one of my user controls, I want to be able to change the background color of the button in certain situations. Initially, I just created a copy of the above XAML, gave it a Key, and then used that key name to style up the Buttons that I wanted to.
As always, there is a better way. I found that there was a way to use a BasedOn in my new style to pull in the style from the global resources and just change what I needed, here is what it looks like:
BTW, Happy Birthday to Eugene Levy, by far one of the funniest actors out there.