ContentControl.ContentTemplate Property
.NET Framework 3.0
Gets or sets the data template used to display the content of the ContentControl. This is a dependency property.
Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration <BindableAttribute(True)> _ Public Property ContentTemplate As DataTemplate 'Usage Dim instance As ContentControl Dim value As DataTemplate value = instance.ContentTemplate instance.ContentTemplate = value
/** @property */ public DataTemplate get_ContentTemplate () /** @property */ public void set_ContentTemplate (DataTemplate value)
public function get ContentTemplate () : DataTemplate public function set ContentTemplate (value : DataTemplate)
<object> <object.ContentTemplate> <DataTemplate .../> </object.ContentTemplate> </object>
<object ContentTemplate="{resourceExtension styleResourceKey}"/>
resourceExtension A markup extension that identifies how to reference the template resource, either StaticResource or DynamicResource. See Resources Overview. styleResourceKey The key that identifies the requested template selector. The key refers to an existing resource in a ResourceDictionary.
Property Value
A data template. The default value is a null reference (Nothing in Visual Basic).Set this property to a DataTemplate to specify the appearance of the ContentControl. For more information on data templates, see Data Templating Overview.
The following examples show how to create a content template and apply the template to a content control.
<DataTemplate x:Key="template1"> <TextBlock Text="{Binding}" FontSize="12" FontWeight="Bold" TextWrapping="Wrap"></TextBlock> </DataTemplate>
<ContentControl Name="contCtrl" ContentTemplate="{StaticResource template1}" Content="This is the content of the content control."/>
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: