Hello. I have such problem: when I try to add aggregate functions for group, that was created from user interface(user drags column headers to grouping panel), i cant use foreach for groups collection, that have more than one element. I get exception, that talk my group collection has changed. But i changed only aggregate functions collection. Code demonstrated such behaviour is below:
What is the way to solve this problem? Please help.
foreach
(var group
in
AssociatedObject.GroupDescriptors)
{
var localGroup = (group
as
GroupDescriptor);
AggregateFunctionCollection aggregateFunctions = localGroup ==
null
?
(@group
as
ColumnGroupDescriptor).Column.AggregateFunctions :
localGroup.AggregateFunctions;
aggregateFunctions.Clear();
aggregateFunctions.Add(
new
CountFunction { Caption = GroupAggregatesName });
}
What is the way to solve this problem? Please help.