FrameworkContentElement.OnStyleChanged(Style, Style) Method

Definition

Invoked when the style that is in use on this element changes.

C#
protected internal virtual void OnStyleChanged(System.Windows.Style oldStyle, System.Windows.Style newStyle);

Parameters

oldStyle
Style

The old style.

newStyle
Style

The new style.

Remarks

This method has a default implementation that sets an internal flag noting the style changed condition.

Notes to Inheritors

Always call the base implementation, otherwise styles cannot be applied. Scenarios for overriding this method might include if your derived class has a specialized style selector, or caches style values. Theme changes will potentially invoke this method.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also