TabControl.ContentTemplate Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the DataTemplate to apply to any TabItem that does not have a ContentTemplate or ContentTemplateSelector property defined.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public DataTemplate ContentTemplate { get; set; }

Property Value

Type: System.Windows.DataTemplate

The DataTemplate to apply to any TabItem that does not have a ContentTemplate or ContentTemplateSelector property defined. The default is null.

<object ContentTemplate="{ResourceExtension TemplateResourceKey}"/>

ResourceExtension

One of the following: StaticResource, or DynamicResource. See XAML Resources.

TemplateResourceKey

The key that identifies the template being requested. The key refers to an existing resource in a ResourceDictionary.

System_CAPS_noteNote

Property element syntax is technically possible, but not recommended. See Inline Styles and Templates.

Identifier field

ContentTemplateProperty

Metadata properties set to true

None

The following example creates two DataTemplate objects. The DataTemplate called contentTemplate is assigned to the ContentTemplate of the TabControl and the DataTemplate called tabItemTemplate is assigned to the ContentTemplate of the second TabItem. All TabItem objects contain the white rectangle defined in contentTemplate, except the second TabItem, which has a gray rectangle, as defined in tabItemTemplate.

.NET Framework
Available since 3.0
Return to top
Show: