ListView and IGrouping
I have a linq2sql query that results in an IGrouping<Users, string
>, that I want to bind to a ListView:
<ListView Name="UsersListView">
<ListView.View>
<GridView>
<GridView.Columns>
</GridView.Columns>开发者_C百科;
</GridView>
</ListView.View>
</Listview>
How can I do this?
You should make CollectionViewSource
in Page.REsources
like below. And bind your CollectionViewSource
The important thing is that IsSourceGrouped = true
<Page.Resources>
<ResourceDictionary>
<CollectionViewSource x:Name="groupedData" IsSourceGrouped="true" Source="{Binding GroupedData}" />
</Page.Resources>
精彩评论