Partager via


IXRFrameworkElement::ApplyTemplate (Compact 2013)

3/28/2014

This method loads the relevant control template so that its parts can be referenced.

Syntax

virtual HRESULT STDMETHODCALLTYPE ApplyTemplate(
    __out bool* pBool
) = 0;

Parameters

  • pBool
    [out] Pointer to a Boolean value that specifies whether the visual tree was rebuilt by this call. This value is true if the visual tree was rebuilt, or false if the previous visual tree was retained.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

For typical element logic within applications, such as when consuming existing controls, calling ApplyTemplate is not necessary, because templates will automatically be applied to elements at an appropriate point in their lifetimes. Generally speaking, ApplyTemplate is used only by authors of controls.

Call this method in cases where a control is the parent of another control that supports templates, and the child control template must exist so that the parent control can apply all necessary state and run-time property settings in the parent's instantiation logic.

Any layout pass that generates a new layout also calls ApplyTemplate on a control.

.NET Framework Equivalent

System.Windows.Controls.ApplyTemplate

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRFrameworkElement