--- title: "How to: Use Templates to Style a ListView That Uses GridView" ms.date: "03/30/2017" helpviewer_keywords: - "ListView controls [WPF], styling" ms.assetid: 94bf964b-96c8-4bdf-a0c3-f5271b7cb565 --- # How to: Use Templates to Style a ListView That Uses GridView This example shows how to use the and objects to specify the appearance of a control that uses a view mode. ## Example The following examples show and objects that customize the appearance of a column header for a . [!code-xaml[ListViewTemplate#GridViewHeaderStyle](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewTemplate/CS/window1.xaml#gridviewheaderstyle)] [!code-xaml[ListViewTemplate#GridViewHeaderTemplate](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewTemplate/CS/window1.xaml#gridviewheadertemplate)] The following example shows how to use these and objects to set the and properties of a . The property defines the content of the column cells. [!code-xaml[ListViewTemplate#GridViewColumnTemplate](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewTemplate/CS/window1.xaml#gridviewcolumntemplate)] The and are only two of several properties that you can use to customize column header appearance for a control. For more information, see [GridView Column Header Styles and Templates Overview](gridview-column-header-styles-and-templates-overview.md). The following example shows how to define a that customizes the appearance of the cells in a . [!code-xaml[ListViewTemplate#GridViewCellTemplate](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewTemplate/CS/window1.xaml#gridviewcelltemplate)] The following example shows how to use this to define the content of a cell. This template is used instead of the property that is shown in the previous example. [!code-xaml[ListViewTemplate#CellTemplateProperty](~/samples/snippets/csharp/VS_Snippets_Wpf/ListViewTemplate/CS/window1.xaml#celltemplateproperty)] ## See also - - - [GridView Overview](gridview-overview.md) - [How-to Topics](listview-how-to-topics.md) - [ListView Overview](listview-overview.md)