How should I make my collection for grouped collection in gridview ?
When I create List<List<MyObject>> groups I get grouped data with good count of groups and elements in each group but I have no group titles.
So I’ve created object MyGroupedObject that has two fields
public String Key;
public List<MyObject> items;
so I have grouped that in object. But when I pass it to the grid view (like below) I have nothing. No items, no groups no nothing
<Page.Resources>
<!--
Collection of grouped items displayed by this page, bound to a subset
of the complete item list because items in groups cannot be virtualized
-->
<CollectionViewSource
x:Name="groupedItemsViewSource"
IsSourceGrouped="true"
/>
</Page.Resources>
than in gridview i just bind this collection as ItemsSource
this question is based on: how to create gridview from dictionary
I’ve created new cause in the original is to many questions so I want to make it all clear
Have you looked at the Grouping and Semantic Zoom sample? http://code.msdn.microsoft.com/windowsapps/groupedgridview-77c59e8e
You can also look at How to group items in a list or grid…
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh780627.aspx
Short explanation is… you can do it one of two ways…
followed by the following to get the data in your CollectionViewSource
Or you can build a hierarchy using object properties like this…
You cannot bind to a simple list and have the grouping automatically configured for you.