I want to Remove Attribute background from code Behind. This is my Xaml Code -
<Button Name="btnBack" Width="50" Height="50"></Button>
And Xml.cs
btnBack.Background = Brushes.Red;
But after some operation i want to remove this attribute with value so my button should come as its original color and "Red" should Remove.
Can Any one help me?
Reset the property to its default value by calling DependencyObject.ClearValue:
btnBack.ClearValue(Control.BackgroundProperty);
This clears a so-called local value (e.g. any value set directly or by a Binding), but keeps any potential value set by a 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