Is there any way for a sub-grouping to know how many items are in the parent-grouping for a CollectionViewSource in .NET
-
09-07-2021 - |
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?
Please and thank you.
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