This documentation is archived and is not being maintained.

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)
XML Namespace:

public DataTemplate HeaderTemplate { get; set; }
/** @property */
public DataTemplate get_HeaderTemplate ()

/** @property */
public void set_HeaderTemplate (DataTemplate value)

public function get HeaderTemplate () : DataTemplate

public function set HeaderTemplate (value : DataTemplate)

    <DataTemplate .../>
<object HeaderTemplate="{resourceExtension templateKey}"/>
 resourceExtension  A markup extension that identifies how to reference the template resource, either StaticResource or DynamicResource. See Resources Overview.  templateKey  The key that identifies the requested template. The key refers to an existing resource in a ResourceDictionary. 

Property Value

A data template used to display a control's header. The default is a null reference (Nothing in Visual Basic).

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 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.

.NET Framework

Supported in: 3.0