編輯

共用方式為


FrameworkContentElement.OnStyleChanged(Style, Style) Method

Definition

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

protected public:
 virtual void OnStyleChanged(System::Windows::Style ^ oldStyle, System::Windows::Style ^ newStyle);
protected internal virtual void OnStyleChanged (System.Windows.Style oldStyle, System.Windows.Style newStyle);
abstract member OnStyleChanged : System.Windows.Style * System.Windows.Style -> unit
override this.OnStyleChanged : System.Windows.Style * System.Windows.Style -> unit
Protected Friend Overridable Sub OnStyleChanged (oldStyle As Style, newStyle As Style)

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

See also