次の方法で共有


IXRContentPresenter::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
    [out] Pointer to an IXRDataTemplate object that represents the data template used to display the content inside this control.

Return Value

Returns an HRESULT that indicates success or failure.

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 user interface (UI) elements in multiple IXRContentControl objects. For example, if you need multiple buttons on your application to display the same graphic, you can create an IXRDataTemplate object 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 object to the IXRDataTemplate object and use the TemplateBinding markup extension on the Content properties to specify the location of the unique content.

Frequently you set a content template in a style, although you can also set it directly on an instance of IXRContentControl.

.NET Framework Equivalent

System.Windows.Controls.ContentPresenter.ContentTemplate

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRContentPresenter
Classes for UI Element Management