This documentation is archived and is not being maintained.

GridView.ColumnHeaderTemplate Property

Gets or sets a template to use to display the column headers.

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

public DataTemplate ColumnHeaderTemplate { get; set; }
/** @property */
public DataTemplate get_ColumnHeaderTemplate ()

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

public function get ColumnHeaderTemplate () : DataTemplate

public function set ColumnHeaderTemplate (value : DataTemplate)

    <DataTemplate .../>
<object ColumnHeaderTemplate="{ResourceExtensionTemplateResourceKey}"/>

 ResourceExtension   StaticResource or DynamicResource. StaticResource typically provides better performance.  TemplateResourceKey  An x:Key resource key that refers to a template resource. 

Property Value

The DataTemplate to use to display the column headers as part of the GridView. The default value is a null reference (Nothing in Visual Basic).

Identifier field


Metadata properties set to true


If the ColumnHeaderTemplate property and the ColumnHeaderTemplateSelector property are both set, the ColumnHeaderTemplate property takes precedence.

This property represents one of several ways to lay out and style column headers. For more information, see GridView Column Header Styles and Templates Overview.

The following example shows how to set the ColumnHeaderTemplate property. For the complete sample, see ListView implementing a GridView with Templates.

<DataTemplate x:Key="myHeaderTemplate">
    <TextBlock FontSize="16" Foreground="DarkBlue">

<GridView ColumnHeaderTemplate="{StaticResource myHeaderTemplate}"
          ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}">
  <GridViewColumn Header="Year" Width="80"
        CellTemplate="{StaticResource myCellTemplateYear}"/>
  <GridViewColumn Header="Month" Width="80"
        CellTemplate="{StaticResource myCellTemplateMonth}"/>
  <GridViewColumn Header="Day" Width="80"
        CellTemplate="{StaticResource myCellTemplateDay}"/>

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