Windows Dev Center

EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

ContentControl.ContentTemplate property

Gets or sets the data template that is used to display the content of the ContentControl.

Syntax


public:
property DataTemplate^ ContentTemplate { 
   DataTemplate^ get();
   void set (DataTemplate^ value);
}


<contentControl>
  <contentControl.ContentTemplate>
    dataTemplate
  </contentControl.ContentTemplate>
</contentControl>


<contentControl ContentTemplate="templateReference"/>

XAML Values

dataTemplate

A DataTemplate object element that defines the display for this ContentControl.

templateReference

A StaticResource reference to an existing DataTemplate definition.

Both attribute and property element syntax for ContentTemplate are shown, because defining the template inline or referencing an existing one as a resource are both equally valid scenarios.

Property value

Type: DataTemplate

The data template that is used to display the content of the ContentControl.

Remarks

Instead of declaring a fixed DataTemplate, you can also implement a DataTemplateSelector and use it to set the ContentTemplateSelector property. This technique enables custom template switching based on input data, at the application level. For more information, see DataTemplateSelector.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

ContentControl

 

 

Mostrar:
© 2015 Microsoft