How to set grouping on a wpf DataGrid that has CompositeCollection as item source?

167 views Asked by At

I'm using c# and WPF. I have a WPF DataGrid that needs to be binded to several data sources. What I did is create for each data source the following code:

var listCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(myObservableCollection);
var collection = new CollectionContainer { Collection = listCollectionView };
myCompositeCollection.Add(collection);

'myCompositeCollection' is my items source for the grid. I can't create one list because the data sources come from different entities and I don't want to handle the add/delete/update/reset of each observable collection.

However each different data source should be in a different group in the grid. How do I add a grouping (even a custom implementation) instead of the regular 'GroupDescriptions' of the ICollectionView that doesn't work on CompositeCollections?

Thanks.

0

There are 0 answers