Can any one explain what OverridesDefaultStyle
actually does to a control? I have read MSDN, but it is not clear.
Asked
Active
Viewed 1.5k times
1 Answers
37
It is used to ignore the default style of a control. By default, if you put a control in your UI, all the properties that are not set locally (explicitly or with a custom style) will take their value from the default style. If you set OverridesDefaultStyle
to true
, the default style won't be used

Thomas Levesque
- 286,951
- 70
- 623
- 758
-
What's a good example of this? I've tried to use it before, but I don't see any changes when I set it to true. – Carlo Mar 26 '14 at 17:08
-
1One issue solved by setting the `OverridesDefaultStyle` to `true` is `DependencyProperty` value inheritance (See [DependencyProperty Value Precedence](https://msdn.microsoft.com/en-us/library/ms743230%28v=vs.110%29.aspx)). Some styles have properties set, that breaks inheritance. Eg.: if you want the same `Foreground` color within a `ItemsControl`, and then uses a `Button`. The Button style will override the Foreground property and the inheritance will not work. – Anders Apr 07 '15 at 08:45
-
So there's no point in setting OverridesDefaultStyle to true on a control if you redefine its control template, right ? – misterfrb Oct 27 '17 at 09:44