This question felt so simple but I just can't find the answer:
How to change a Button back to its default? My VS2010 start giving me button with strange color and I have to manually set the Button to look like its default self.
I tried:
btn.Background = null; // only make it transparent, not default background
Anyone?
Use the ClearValue-method to restore the default.
btn.ClearValue(Button.BackgroundProperty);
or
btn.ClearValue(Control.BackgroundProperty);
This sets back the background-property of the button. But if you have changed the buttons template, this will not help. In this case, look for explicit declarations of the Button.Template-property or for a style that sets the Button.Template-property. Look especially in your App.xaml if there is something like
<style TargetType="Button">
...
</style>
or
<style TargetType="{x:Type Button}">
...
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With