Compartilhar via


IXRContentControl::SetContentTemplate (Compact 2013)

3/28/2014

This method sets the object that represents the data template used to display the content inside this control.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetContentTemplate(
  __in IXRDataTemplate* pContentTemplate
) = 0;

Parameters

  • pContentTemplate
    [in] Pointer to an IXRDataTemplate object that represents the data template for displaying the content that is inside this control.

Return Value

Returns an HRESULT that indicates success or failure.

Returns XR_E_INVALID_OBJECT if pContentTemplate is not a XAML for Windows Embedded object.

Remarks

The IXRDataTemplate object specifies the visual structure that determines the appearance of the content of the control.

Use the IXRContentControl::SetContentTemplate method to display the same UI elements in multiple IXRContentControl objects. For example, suppose you need multiple buttons on your application to display the same graphic. You can create an IXRDataTemplate that contains the graphic and use it as the content template for the buttons.

If you want the buttons to contain both shared elements and unique content, you can add an IXRContentPresenter to the IXRDataTemplate and use the TemplateBinding markup extension on the Content properties to specify the location of the unique content.

You frequently set a content template in a style, although it can also be set directly on an instance of an IXRContentControl.

.NET Framework Equivalent

System.Windows.Controls.ContentControl.ContentTemplate

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRContentControl
Classes for UI Element Management