Loads the relevant control template so that its parts can be referenced.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Function ApplyTemplate As Boolean
public bool ApplyTemplate()
Returns whether the visual tree was rebuilt by this call. true indicates the tree was rebuilt; false indicates that the previous visual tree was retained.
For typical element logic within applications, such as when consuming existing controls, calling ApplyTemplate is not necessary, because templates will be applied to elements at an appropriate point in their lifetimes automatically. ApplyTemplate is generally speaking used only by authors of controls.
Call this method for cases where a control is the parent of another templated control, and the child control template must exist so that the parent control can apply all necessary state and run-time property setting in the parent's instantiation logic.
Any layout pass that generates a new layout will also call ApplyTemplate on a control.
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.