ContentControl.ContentTemplate Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the data template that is used to display the content of the ContentControl.
DataTemplate ContentTemplate();
void ContentTemplate(DataTemplate value);
public DataTemplate ContentTemplate { get; set; }
var dataTemplate = contentControl.contentTemplate;
contentControl.contentTemplate = dataTemplate;
Public Property ContentTemplate As DataTemplate
<contentControl>
<contentControl.ContentTemplate>
dataTemplate
</contentControl.ContentTemplate>
</contentControl>
- or -
<contentControl ContentTemplate="templateReference"/>
Property Value
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.