* 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
1.9 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|
| How to: Group Items in a ListView That Implements a GridView | 03/30/2017 |
|
eebef25b-ddc6-424e-a66d-ea228d1bf33d |
How to: Group Items in a ListView That Implements a GridView
This example shows how to display groups of items in the xref:System.Windows.Controls.GridView view mode of a xref:System.Windows.Controls.ListView control.
Example
To display groups of items in a xref:System.Windows.Controls.ListView, define a xref:System.Windows.Data.CollectionViewSource. The following example shows a xref:System.Windows.Data.CollectionViewSource that groups data items according to the value of the Catalog data field.
[!code-xamlGridViewWithGroups#GroupingCollectionViewSource]
The following example sets the xref:System.Windows.Controls.ItemsControl.ItemsSource%2A for the xref:System.Windows.Controls.ListView to the xref:System.Windows.Data.CollectionViewSource that the previous example defines. The example also defines a xref:System.Windows.Controls.ItemsControl.GroupStyle%2A that implements an xref:System.Windows.Controls.Expander control.
[!code-xamlGridViewWithGroups#ListViewGroups]
[!code-xamlGridViewWithGroups#ListViewEnd]