Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Control.OnTemplateChanged Method

Called whenever the control's template changes.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

protected virtual void OnTemplateChanged (
	ControlTemplate oldTemplate,
	ControlTemplate newTemplate
)
protected void OnTemplateChanged (
	ControlTemplate oldTemplate, 
	ControlTemplate newTemplate
)
protected function OnTemplateChanged (
	oldTemplate : ControlTemplate, 
	newTemplate : ControlTemplate
)
You cannot use methods in XAML.

Parameters

oldTemplate

The old template.

newTemplate

The new template.

Return Value

A template.

The timing for changing the template is as follows:

  1. Somehow the template is changed, for example, by SetValue or a style trigger.

  2. The property value changes; the property changed callback is called.

  3. The old visual tree is removed.

  4. An internal method is called which eventually calls OnTemplateChanged.

  5. Later, during a measure EnsureVisuals is called and a new visual tree is attached.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft