Control.OnTemplateChanged(ControlTemplate, ControlTemplate) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
每当控件的模板更改时调用。
protected:
virtual void OnTemplateChanged(System::Windows::Controls::ControlTemplate ^ oldTemplate, System::Windows::Controls::ControlTemplate ^ newTemplate);
protected virtual void OnTemplateChanged(System.Windows.Controls.ControlTemplate oldTemplate, System.Windows.Controls.ControlTemplate newTemplate);
abstract member OnTemplateChanged : System.Windows.Controls.ControlTemplate * System.Windows.Controls.ControlTemplate -> unit
override this.OnTemplateChanged : System.Windows.Controls.ControlTemplate * System.Windows.Controls.ControlTemplate -> unit
Protected Overridable Sub OnTemplateChanged (oldTemplate As ControlTemplate, newTemplate As ControlTemplate)
参数
- oldTemplate
- ControlTemplate
旧模板。
- newTemplate
- ControlTemplate
新模板。
注解
更改模板的计时如下所示:
模板由 SetValue 方法调用、样式触发器或其他某种方式更改。
属性值更改;调用属性更改的回调。
删除旧的可视化树。
调用内部方法,最终会调用该方法 OnTemplateChanged 。
稍后,在度量 OnApplyTemplate 值期间调用并附加新的可视化树。