Partager via


IXRDataTemplate (Compact 2013)

3/28/2014

This class describes the visual structure of a data object.

Syntax

class IXRDataTemplate : public IXRFrameworkTemplate

Inheritance Hierarchy

IXRFrameworkTemplate

     IXRDataTemplate

Methods

Function

Description

IXRDataTemplate::LoadContent

Loads the content that defines the visual representation for the control that uses this IXRDataTemplate.

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

You typically use an IXRDataTemplate object to specify the visual representation of the content of a control, such as an IXRItemsControl. For example, if each item in a data collection includes a path to an image file and a string, you might display the string above an image control that displays the image. This is useful for controls that have multiple objects, such as an IXRItemsControl, and for objects that define how content is presented, such as an IXRContentPresenter. If the visual representation is defined in source XAML, IXRDataTemplate loads it and represents it as an object in the visual tree at run time.

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

In C++ code, you can retrieve the IXRDataTemplate for an IXRItemsControl by calling IXRItemsControl::GetItemTemplate. Then, you can set that template for another IXRItemsControl by passing it into IXRItemsControl::SetItemTemplate.

You must define this element in XAML using the DataTemplate element.

.NET Framework Equivalent

System.Windows.DataTemplate

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Visual Appearance
IXRItemsControl::GetItemTemplate
IXRItemsControl::SetItemTemplate
IXRContentControl::GetContentTemplate
IXRContentControl::SetContentTemplate
IXRContentPresenter::GetContentTemplate
IXRContentPresenter::SetContentTemplate