This documentation is archived and is not being maintained.

GridViewHeaderRowPresenter Class

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

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

/** @attribute StyleTypedPropertyAttribute(Property="ColumnHeaderContainerStyle", StyleTargetType=System.Windows.Controls.GridViewColumnHeader) */ 
public class GridViewHeaderRowPresenter extends GridViewRowPresenterBase
StyleTypedPropertyAttribute(Property="ColumnHeaderContainerStyle", StyleTargetType=System.Windows.Controls.GridViewColumnHeader) 
public class GridViewHeaderRowPresenter extends GridViewRowPresenterBase
<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 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