I'm using a CollectionViewSource
to group my data. In my data, I have Property1
and Property2
that I'm needing to group on.
The only stipulation is that I don't want sub-groups of another group. So, when I group by these two properties, I don't want to have it so that Property2
because a subgroup of Property1
's group.
The reason why I want this is because I need to have a header that shows the following information:
Header:
<TextBlock.Text>
<MultiBinding StringFormat="Property1: {0}, Property2: {1}">
<Binding Path="Property1"/>
<Binding Path="Property2"/>
</MultiBinding>
</TextBlock.Text>
I've tried this with my CollectionViewSource but was not able to "combine" 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>