I use CollectionViewSource to group my data. According to my data, I have Property1 and Property2 that I need to group.
The only condition is that I do not want a subgroup of another group. Therefore, when I group these two properties, I do not want to have it so that Property2 , because the subgroup of the group is Property1 .
The reason I want this is because I need a header that shows the following information:
Title:
<TextBlock.Text> <MultiBinding StringFormat="Property1: {0}, Property2: {1}"> <Binding Path="Property1"/> <Binding Path="Property2"/> </MultiBinding> </TextBlock.Text>
I tried this with my CollectionViewSource, but could not "merge" the group and subgroup together:
<CollectionViewSource x:Key="myKey" Source="{Binding myDataSource}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="Property1" /> <PropertyGroupDescription PropertyName="Property2" /> </CollectionViewSource.GroupDescriptions> </CollectionViewSource>
Is it possible to group two properties together? Something like below?
<CollectionViewSource x:Key="myKey" Source="{Binding myDataSource}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="Property1,Property2" /> </CollectionViewSource.GroupDescriptions> </CollectionViewSource>
wpf grouping collectionviewsource
Miles
source share