* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
3.1 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |
|---|---|---|---|---|
| How to: Use Templates to Style a ListView That Uses GridView | 03/30/2017 |
|
94bf964b-96c8-4bdf-a0c3-f5271b7cb565 |
How to: Use Templates to Style a ListView That Uses GridView
This example shows how to use the xref:System.Windows.DataTemplate and xref:System.Windows.Style objects to specify the appearance of a xref:System.Windows.Controls.ListView control that uses a xref:System.Windows.Controls.GridView view mode.
Example
The following examples show xref:System.Windows.Style and xref:System.Windows.DataTemplate objects that customize the appearance of a column header for a xref:System.Windows.Controls.GridViewColumn.
[!code-xamlListViewTemplate#GridViewHeaderStyle]
[!code-xamlListViewTemplate#GridViewHeaderTemplate]
The following example shows how to use these xref:System.Windows.Style and xref:System.Windows.DataTemplate objects to set the xref:System.Windows.Controls.GridViewColumn.HeaderContainerStyle%2A and xref:System.Windows.Controls.GridViewColumn.HeaderTemplate%2A properties of a xref:System.Windows.Controls.GridViewColumn. The xref:System.Windows.Controls.GridViewColumn.DisplayMemberBinding%2A property defines the content of the column cells.
[!code-xamlListViewTemplate#GridViewColumnTemplate]
The xref:System.Windows.Controls.GridViewColumn.HeaderContainerStyle%2A and xref:System.Windows.Controls.GridViewColumn.HeaderTemplate%2A are only two of several properties that you can use to customize column header appearance for a xref:System.Windows.Controls.GridView control. For more information, see GridView Column Header Styles and Templates Overview.
The following example shows how to define a xref:System.Windows.DataTemplate that customizes the appearance of the cells in a xref:System.Windows.Controls.GridViewColumn.
[!code-xamlListViewTemplate#GridViewCellTemplate]
The following example shows how to use this xref:System.Windows.DataTemplate to define the content of a xref:System.Windows.Controls.GridViewColumn cell. This template is used instead of the xref:System.Windows.Controls.GridViewColumn.DisplayMemberBinding%2A property that is shown in the previous xref:System.Windows.Controls.GridViewColumn example.
[!code-xamlListViewTemplate#CellTemplateProperty]