Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-group-items-in-a-listview-that-implements-a-gridview.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* 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
2020-09-04 09:46:28 -07:00

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
ListView controls [WPF], grouping items with GridViews
grouping items in ListViews implementing GridViews [WPF]
GridView controls [WPF], grouping items
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]

See also