This documentation is archived and is not being maintained.

GridViewColumnHeader Class

Represents a column header for a GridViewColumn.

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

[TemplatePartAttribute(Name = "PART_HeaderGripper", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = "PART_FloatingHeaderCanvas", Type = typeof(Canvas))]
public class GridViewColumnHeader : ButtonBase

A GridViewColumnHeader object is a button control that is derived from ButtonBase. GridViewColumnHeader properties keep track of mouse events and the resizing of columns.

Column headers in a GridView view mode are GridViewColumnHeader objects.

You can customize GridViewColumnHeader objects 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.

Content Model: GridViewColumnHeader is a ContentControl. Its content property is Content. For more information on the content model for GridViewColumnHeader, see Controls Content Model Overview.

Each GridViewColumnHeader can contain a context (right-click) menu. The following example shows how to create a context menu for a GridViewColumnHeader in XAML.

<GridViewColumn DisplayMemberBinding=
        "{Binding Path=LastName}" 
    <GridViewColumnHeader>Last Name
        <ContextMenu  MenuItem.Click="LastNameCM_Click"  
            <MenuItem Header="Ascending" />
            <MenuItem Header="Descending" />

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