HeaderedItemsControl.Header Property


Gets or sets the item that labels the control.

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

public object Header { get; set; }

Property Value

Type: System.Object

An object that labels the HeaderedItemsControl. The default is null. A header can be a string or a UIElement.

Because the Header property is of type Object, there are no restrictions on what you can put in the Header. The Header is displayed by a ContentPresenter, which is in the HeaderTemplate of the HeaderedItemsControl. For more information about how the ContentPresenter displays the Header, see ContentPresenter.

<object Header="headerString"/>

    <UIElement />


The string to use as a heading.

Identifier field


Metadata properties set to true


The following example shows how to create and use a header template to specify the appearance of the header.

<!--Define a control template for a HeaderedItemsControl-->
<Style TargetType="HeaderedItemsControl">
  <Setter Property="Template">
      <ControlTemplate TargetType="{x:Type HeaderedItemsControl}">
            <Rectangle Fill="{TemplateBinding Background}"/>
            <ContentPresenter ContentSource="Header"/>
            <Rectangle Stroke="{TemplateBinding BorderBrush}"/>
            <ItemsPresenter Margin="2,0,0,0"/>
<DataTemplate x:Key="RedHeaderTemplate">
  <TextBlock Text="{Binding}" Foreground="Red" 
             FontSize="16" FontWeight="Bold" 

<DataTemplate x:Key="GreenItemTemplate">
  <TextBlock Text="{Binding}" Foreground="Green" 
             FontSize="14" FontWeight="Bold"></TextBlock>
<!--Crate a HeaderedItemControl with a red header and green items.-->
<HeaderedItemsControl Name="hitemsCtrl"  
                      HeaderTemplate="{StaticResource RedHeaderTemplate}"
                      ItemsSource="{Binding Source={StaticResource Numbers}}"
                      ItemTemplate = "{StaticResource GreenItemTemplate}" />

.NET Framework
Available since 3.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top