tags:

views:

32

answers:

0

I'm using a Collection View Source 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'm wanting this is because I'm wanting 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>