'Declaration
Public Property ContentTemplate As DataTemplate
'Usage
Dim instance As ContentControl Dim value As DataTemplate instance.ContentTemplate = value value = instance.ContentTemplate
public DataTemplate ContentTemplate {get; set;}
'Declaration
Public Property ContentTemplate As DataTemplate
'Usage
Dim instance As ContentControl Dim value As DataTemplate instance.ContentTemplate = value value = instance.ContentTemplate
public DataTemplate ContentTemplate {get; set;}
In the following example, the ContentControl binds its Content to UserObject.
The ContentTemplate defines a template for displaying said Content & uses bindings to retrieve the Name & Goals values from UserObject.
<xctk:ContentControl Content="{Binding UserObject, Source={x:Reference _contentPage} }"> <xctk:ContentControl.ContentTemplate> <DataTemplate> <xctk:Border Background="LightGray" BorderBrush="Black" BorderThickness="2" CornerRadius="5"> <HorizontalStackLayout> <Label Text="This is" Margin="5"/> <Label Text="{Binding Name}" TextColor="Red" Margin="5"/> <Label Text="and he scored" Margin="5"/> <Label Text="{Binding Goals}" TextColor="Blue" FontAttributes="Bold" Margin="5"/> <Label Text="Goals." Margin="5"/> </HorizontalStackLayout> </xctk:Border> </DataTemplate> </xctk:ContentControl.ContentTemplate> </xctk:ContentControl>
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2