Header Property
Collapse the table of content
Expand the table of content

HeaderedContentControl.Header Property

Gets or sets the data used for the header of each control.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public Object Header { get; set; }
    <Object .../>

Property Value

Type: System.Object
A header object. The default is null.

Identifier field


Metadata properties set to true


Like the Content property of a ContentControl, the Header can be any type. The HeaderedContentControl uses the same logic to display the Header that is described in ContentControl.Content.

The following example creates a TabControl that contains two TabItem objects, which inherit from HeaderedContentControl. The first TabItem has UIElement objects as the content in both the Header and the Content: the Header is set to a StackPanel that contains an Ellipse and a TextBlock; the Content is set to a StackPanel that contains a TextBlock and a Label. The Header of the second TabItem is set to a string and the Content is set to a single TextBlock.

      <StackPanel Orientation="Horizontal">
        <Ellipse Width="10" Height="10" Fill="DarkGray"/>
        <TextBlock>Tab 1</TextBlock>
      <TextBlock>Enter some text</TextBlock>
      <TextBox Name="textBox1" Width="50"/>
  <TabItem Header="Tab 2">
    <!--Bind TextBlock.Text to the TextBox on the first
    <TextBlock Text="{Binding ElementName=textBox1, Path=Text}"/>

The following illustration shows the TabControl created by the previous example.

TabControl with different types in the Header property


The following example creates two DataTemplate objects to specify the appearance of the Header and Content of the HeaderedContentControl.

<Style TargetType="HeaderedContentControl">
  <Setter Property="Template">
      <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
            <Rectangle Stroke="{TemplateBinding Background}"/>
            <ContentPresenter ContentSource="Header"/>
            <Rectangle Fill="{TemplateBinding Background}"/>
            <ContentPresenter ContentSource="Content"/>

<DataTemplate x:Key="titleText">
  <TextBlock Text="{Binding}" 

<DataTemplate x:Key="contentText">
  <TextBlock Text="{Binding}"
             FontFamily="Arial Narrow" 


<HeaderedContentControl Name="hcontCtrl" Background="Beige" 
                        HeaderTemplate="{StaticResource titleText}" 
                        ContentTemplate="{StaticResource contentText}"
                        Header="This is the header."
                        Content="This is the content."/>

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft