Export (0) Print
Expand All
3 out of 3 rated this helpful - Rate this topic

GridViewColumnHeader Class

Represents a column header for a GridViewColumn.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
[TemplatePartAttribute(Name = "PART_HeaderGripper", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = "PART_FloatingHeaderCanvas", Type = typeof(Canvas))]
public class GridViewColumnHeader : ButtonBase
<GridViewColumnHeader>
  Content
</GridViewColumnHeader>

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}" 
    Width="100">
    <GridViewColumnHeader>Last Name
        <GridViewColumnHeader.ContextMenu>
        <ContextMenu  MenuItem.Click="LastNameCM_Click"  
                      Name="LastNameCM">
            <MenuItem Header="Ascending" />
            <MenuItem Header="Descending" />
        </ContextMenu>
        </GridViewColumnHeader.ContextMenu>
    </GridViewColumnHeader>
</GridViewColumn>

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.
System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
              System.Windows.Controls.ContentControl
                System.Windows.Controls.Primitives.ButtonBase
                  System.Windows.Controls.GridViewColumnHeader
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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.