Is there anyway to turn off a style programatically?
As an example, I have a style that is linked to all textboxes
<Style TargetType="{x:Type TextBox}">
I would like to add some code to actually stop the style elements being used, so basically reverting back to the default control style.
I need a way to make a switch in my styles, so I can switch between Windows default style and my custom style through C# code.
Is there anyway to do this?
Thanks
Working Solution
For setting the style to default,
In XAML use,
In C# use,
If style needs to be set as null for multiple resources, see CodeNaked’s response.
In code Behind I think this is what you are trying to achieve: