--- title: "How to: Create a Style for a Dragged GridView Column Header" ms.date: "03/30/2017" helpviewer_keywords: - "ListView controls [WPF], styling" ms.assetid: 0b999645-0313-4b33-80b9-19ece08b5459 --- # How to: Create a Style for a Dragged GridView Column Header This example shows how to change the appearance of a dragged when the user changes the position of a column. ## Example When you drag a column header to another location in a that uses 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 is represented by a object. To customize the appearance of both the floating and original headers, you can set to modify the . These are applied when the property value is `true` and the property value is . When the user presses the mouse button and holds it down while the mouse pauses on the , the property value changes to `true`. Likewise, when the user begins the drag operation, the property changes to . The following example shows how to set to change the and colors of the original and floating headers when the user drags a column to a new position. [!code-xaml[ListViewHeaderRoleStyle#GVCHControlTemplateStart](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#gvchcontroltemplatestart)] [!code-xaml[ListViewHeaderRoleStyle#ControlTemplateTriggersStart](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#controltemplatetriggersstart)] [!code-xaml[ListViewHeaderRoleStyle#IsPressed](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#ispressed)] [!code-xaml[ListViewHeaderRoleStyle#Floating](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#floating)] [!code-xaml[ListViewHeaderRoleStyle#ControlTemplateTriggersEnd](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#controltemplatetriggersend)] [!code-xaml[ListViewHeaderRoleStyle#GVCHControlTemplateEnd](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewHeaderRoleStyle/CS/Window1.xaml#gvchcontroltemplateend)] ## See also - - - - - [How-to Topics](listview-how-to-topics.md) - [ListView Overview](listview-overview.md) - [GridView Overview](gridview-overview.md)