Click to Rate and Give Feedback
MSDN
MSDN Library
Collapse All/Expand All Collapse All
.NET Framework Class Library for Silverlight
Control..::.OnApplyTemplate Method

When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate.

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

Visual Basic (Declaration)
Public Overridable Sub OnApplyTemplate
Visual Basic (Usage)
Dim instance As Control

instance.OnApplyTemplate()
C#
public virtual void OnApplyTemplate()
Visual C++
public:
virtual void OnApplyTemplate()
JScript
public function OnApplyTemplate()

Notes to Implementers:

This method has no default implementation.

Derived classes can use this method as a notification to:

  • Builds the remainder of an element visual tree using custom code.

  • Run code that relies on the visual tree from templates having been applied, such as obtaining references to named elements that came from a template.

  • Introduce services that only make sense to exist after the visual tree from templates is complete.

  • Set states and properties of elements within the template that are dependent on other factors. For instance, property values might only be discoverable by knowing the parent element, or when a specific derived class uses a common template.

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker