Поделиться через


IXRControlTemplate (Compact 2013)

3/28/2014

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

Syntax

class IXRControlTemplate : public IXRFrameworkTemplate

Inheritance Hierarchy

IXRFrameworkTemplate

    IXRControlTemplate

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.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

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 XAML 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.

When you create a class instance, use an IXRControlTemplatePtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define a control template in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see the ControlTemplate Class on MSDN.

.NET Framework Equivalent

System.Windows.Controls.ControlTemplate

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Visual Appearance