Is there any way for a sub-grouping to know how many items are in the parent-grouping for a CollectionViewSource in .NET

StackOverflow https://stackoverflow.com/questions/12977095

Question

I have a Collection View source in which I've set two Group Descriptions

myCollectionViewSource.GroupDescriptions.Add(New PropertyGroupDescription("PrimaryProperty"))
myCollectionViewSource.GroupDescriptions.Add(New PropertyGroupDescription("SecondaryProperty"))

As Illustrated below, the primary grouping has found 338 records. Those are broken up into 179 pairs of records based on the secondary GroupDescription. If I'm evaluating a child grouping element, is there a way for me to get the ItemCount of the primary grouping from which it originally comes?

View of Groups

Please and thank you.

Was it helpful?

Solution

based on your local values, you can simply use the following expression

((MS.Internal.Data.CollectionViewGroupInternal)myCollectionViewSource.View.Groups[0]).ItemCount
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top