How to add multiple properties to a CollectionViewGroup?

时间:2018-02-03 09:27:21

标签: c# wpf xaml

I'm looking for a way to add multiple properties on a CollectionViewGroup, actually I defined two CollectionViewGroup:

<Window.Resources>
    <ResourceDictionary>
       <CollectionViewSource Source="{Binding Collections}" x:Key="GroupedItems">
            <CollectionViewSource.GroupDescriptions>
                <PropertyGroupDescription PropertyName="Name" />
                <PropertyGroupDescription PropertyName="Surname" />
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
    </ResourceDictionary>
</Window.Resources>

so in my DataGrid I've this implementation

<DataGrid ItemsSource="{Binding Source={StaticResource GroupedItems}}">
    <DataGrid.Columns>
        some columns
    </DataGrid.Columns>
    <GroupStyle>
       ...
    </GroupStyle>
    <GroupStyle>
       ...
    </GroupStyle>
 </DataGrid>

now in my second Group I want also group for another property called Number, so I should get this visualization:

Name                 <--Items grouping
   Surname
      Number 1
      Number 2 
      Number 3

is possible do that? 'cause I can set only a PropertyName for each group, thanks.

0 个答案:

没有答案