HeaderedItemsControl.HeaderTemplate Property

Gets or sets the template used to display the contents of the control's header. This is a dependency property.

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 DataTemplate HeaderTemplate { get; set; }
<object HeaderTemplate="{ResourceExtension TemplateResourceKey}"/>

XAML Values


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


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


Property element syntax is technically possible, but not recommended. See Inline Styles and Templates. A binding reference using TemplateBinding or Binding is also possible, but uncommon.

Property Value

Type: System.Windows.DataTemplate
A data template used to display a control's header. The default is null.

Identifier field


Metadata properties set to true


To customize the heading of the HeaderedItemsControl, set this property to a DataTemplate. For more information on data templates, see Data Templating Overview.

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}" />

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft