Contents of the WPF OverridesDefaultStyle property

less than 1 minute read


I didn’t understand the contents of the FrameworkElement.OverridesDefaultStyle property of WPF even after reading the explanation of MSDN, so it is a memo when I examined it.

FrameworkElement.OverridesDefaultStyle Property –MSV


It was written on the Stack Overflow page below.

OverridesDefaultStyle in WPF - Stack Overflow

According to the above, it is used to ignore the control’s default style.
By default, when you place a control in the UI, the values of all properties not set within that control are taken from the default style.
It seems that setting OverridesDefaultStyle to true prevents the value from being retrieved from the default style.

As for Japanese articles, the person from “Shibayan miscellaneous notes”, which is now famous for Azure articles (2020), posted the following in 2008.

Note that if Template is not specified but OverridesDefaultStyle = True, nothing will be displayed.

WPF memo (27) –Shibayan miscellaneous notes