IXRControl::SetTemplate (Windows Embedded CE 6.0)

1/6/2010

This method sets the control template that is used to define the appearance of this control.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetTemplate(
    IXRControlTemplate *pTemplate
) = 0; 

Parameters

  • pTemplate
    [in] Pointer to an IXRControlTemplate object that defines the new appearance of this control.

Return Value

Returns an HRESULT that indicates success or failure.

Returns XR_E_INVALID_OBJECT if pTemplate is not a Silverlight object.

Remarks

A control template can be defined in Microsoft Silverlight 2 XAML markup by using the <ControlTemplate> markup element. For information about the differences between XAML in Silverlight for Windows Embedded and Silverlight 2, see Differences Between Silverlight for the Web and Silverlight for Windows Embedded. For more information about how to define this element in the source XAML for your application, see this Microsoft Web site.

If an IXRControl has an IXRControlTemplate associated with it, the control can appear in your application UI.

You can set a new IXRControlTemplate template for your custom control by using a template that is already defined in XAML for another control. To do this, you can retrieve the IXRControlTemplate class instance from the other control, and then use IXRControl::SetTemplate to apply it to your custom control. The TargetType attribute for the control template must be set correctly in XAML for the custom control in order for this to work correctly.

.NET Framework Equivalent

System.Windows.Controls.Control.Template

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

IXRControl
IXRControl::GetTemplate