WPF: How do I discard all inherited styles?
styles, wpf
Solution
You can create your own container for the piece of UI in question, and set `InheritanceBehavior` to `SkipAllNow` (or the value appropriate for your situation):
using System.Windows;
using System.Windows.Controls;
public class NoInheritanceContentControl : ContentControl
{
public NoInheritanceContentControl()
{
InheritanceBehavior = InheritanceBehavior.SkipAllNow;
}
}
Then you can just stick `NoInheritanceContentControl` in your visual tree and anything inside it won't inherit styles.
Problem
How do I tell a control or block of controls to not inherit any styles and revert back to the defaults? I need this because I have an overall theme that mostly works, but for one piece really screws up my design.