Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

GridViewColumnHeaderRole Enumeration

Defines the state or role of a GridViewColumnHeader control.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
public enum GridViewColumnHeaderRole
<object property="enumerationMemberName" .../>
Member nameDescription
FloatingThe column header is the object of a drag-and-drop operation to move a column.
NormalThe column header displays above its associated column.
PaddingThe column header is the last header in the row of column headers and is used for padding.

The role of a GridViewColumnHeader is defined by the read-only Role property.

This example shows how to change the appearance of a dragged GridViewColumnHeader when the user changes the position of a column.

When you drag a column header to another location in a ListView that uses GridView for its view mode, the column moves to the new position. While you are dragging the column header, a floating copy of the header appears in addition to the original header. A column header in a GridView is represented by a GridViewColumnHeader object.

To customize the appearance of both the floating and original headers, you can set Triggers to modify the GridViewColumnHeader Style. These Triggers are applied when the IsPressed property value is true and the Role property value is Floating.

When the user presses the mouse button and holds it down while the mouse pauses on the GridViewColumnHeader, the IsPressed property value changes to true. Likewise, when the user begins the drag operation, the Role property changes to Floating.

The following example shows how to set Triggers to change the Foreground and Background colors of the original and floating headers when the user drags a column to a new position.

<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">


...


<ControlTemplate.Triggers>


...


<Trigger Property="IsPressed"
         Value="true">
  <Setter TargetName="HighlightBorder"
          Property="Visibility"
          Value="Hidden"/>
  <Setter TargetName="PART_HeaderGripper"
          Property="Visibility"
          Value="Hidden"/>
  <Setter Property="Background"
          Value="SkyBlue"/>
  <Setter Property="Foreground"
          Value="Yellow"/>
</Trigger>


...


<Trigger Property="Role"
         Value="Floating">
  <Setter TargetName="PART_HeaderGripper"
          Property="Visibility"
          Value="Collapsed"/>
  <Setter Property="Background"
          Value="Yellow"/>
  <Setter Property="Foreground"
          Value="SkyBlue"/>
</Trigger>


...


</ControlTemplate.Triggers>


...


</ControlTemplate>

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.