IXRControlTemplate (Windows Embedded CE 6.0)

1/6/2010

This class represents the element tree that is applied as a control template for a control.

Syntax

class IXRControlTemplate : public IXRFrameworkTemplate

Methods

Method Description

IXRControlTemplate::GetTargetType

Retrieves the object type to which this control template is applied.

IXRControlTemplate::SetTargetType

Sets the object type to which this control template is applied.

Remarks

This class represents a control template that was defined in the source XAML for your application and was loaded into the object tree by Silverlight for Windows Embedded. For this object to work correctly at run time, the TargetType attribute of the <ControlTemplate> XAML element must be set correctly for the control.

You can retrieve an IXRControlTemplate class instance by retrieving an IXRControl pointer to a named object in the object tree and calling IXRControl::GetTemplate on that object.

To retrieve an object in the object tree, you must obtain a pointer to the visual host, retrieve the IXRFrameworkElement root of the visual tree that belongs to that visual host, and then call IXRFrameworkElement::FindName to traverse through the visual tree structure and retrieve an object pointer to an IXRControlTemplate object.

You can apply an IXRControlTemplate template already defined in XAML for another control to your custom control. To do this, retrieve the IXRControlTemplate class instance from the other control, call IXRControlTemplate::SetTargetType, and then use IXRControl::SetTemplate to apply it to your custom control.

You can also define a control template in Microsoft Silverlight 2 XAML. 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.

Inheritance Hierarchy

IXRDependencyObject

    IXRControlTemplate

.NET Framework Equivalent

System.Windows.Controls.ControlTemplate

Requirements

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

See Also

Reference

Classes for Visual Appearance and Behavior