Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.62 KB

contentcontrol_contenttemplate.md

File metadata and controls

41 lines (30 loc) · 1.62 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.ContentControl.ContentTemplate
winrt property

Windows.UI.Xaml.Controls.ContentControl.ContentTemplate

-description

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

-xaml-syntax

<contentControl>
  <contentControl.ContentTemplate>
    dataTemplate
  </contentControl.ContentTemplate>
</contentControl>
- or -
<contentControl ContentTemplate="templateReference"/>

-xaml-values

dataTemplate
dataTemplateA DataTemplate object element that defines the display for this ContentControl.
templateReference
templateReferenceA {StaticResource} markup extension 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 The data template that is used to display the content of the [ContentControl](contentcontrol.md).

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

-examples

-see-also