This documentation is archived and is not being maintained.

GridViewHeaderRowPresenter Class

Updated: July 2008

Represents an object that is used to define the layout of a row of column headers.

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

<StyleTypedPropertyAttribute(Property := "ColumnHeaderContainerStyle", StyleTargetType := GetType(GridViewColumnHeader))> _
Public Class GridViewHeaderRowPresenter _
	Inherits GridViewRowPresenterBase
Dim instance As GridViewHeaderRowPresenter
<GridViewHeaderRowPresenter .../>

This GridViewRowPresenter object and GridViewHeaderRowPresenter objects are support objects for the GridView View mode that displays data in columns for a ListView. For more information about how to define a GridView view, see the GridView Overview.

You can determine when a column is moving to a new location by monitoring the CollectionChanged event that is defined for the GridViewColumnCollection.

You can customize column headers in a GridView view mode by using a variety of properties that are found in this class and in related classes. For more information about these properties, and about the precedence between them, see GridView Column Header Styles and Templates Overview.

This example shows how to use the GridViewRowPresenter and GridViewHeaderRowPresenter objects to display data in columns.

The following example shows how to specify a GridViewColumnCollection that displays the DayOfWeek and Year of a DateTime object by using GridViewRowPresenter and GridViewHeaderRowPresenter objects. The example also defines a Style for the Header of a GridViewColumn.

<Window xmlns="" 


    <Style x:Key="MyHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
     <Setter Property="Background" Value="BurlyWood"/>

    <GridViewColumnCollection x:Key="gvcc">
      <GridViewColumn Header="Year" 
                      DisplayMemberBinding="{Binding Year}" 
      <GridViewColumn Header="Day"  
                      DisplayMemberBinding="{Binding DayOfWeek}" 
                      Width="80" />



    <GridViewHeaderRowPresenter Name="hrp" Columns="{StaticResource gvcc}"  
                                 "{StaticResource MyHeaderStyle}" />

    <GridViewRowPresenter Columns="{StaticResource gvcc}" >
    <GridViewRowPresenter Columns="{StaticResource gvcc}" >


More Code

How to: Create a Style for a Dragged GridView Column Header This example shows how to change the appearance of a dragged GridViewColumnHeader when the user changes the position of a column.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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




July 2008

Added new members: ColumnHeaderStringFormat property, ColumnHeaderStringFormatProperty field.

SP1 feature change.