Apply Aggregate Functions When Using Generic Group Descriptors
Environment
Product Version | 2025.3.815 |
Product | RadGridView for WPF |
Description
Apply aggregate functions when using the generic group descriptors.
Solution
To apply aggregate functions when working with generic group descriptors, you can define your function, and add it to its AggregateFunctions
collection.
Generic group descriptor with aggregate function
var descriptor = new GroupDescriptor<Employee, int, int>
{
GroupingExpression = e => e.Orders.Where(o => o.Details.Any(d => d.Product.ProductName.Contains("Syrup"))).Count(),
SortDirection = ListSortDirection.Ascending
};
descriptor.AggregateFunctions.Add(new SumFunction(){ Caption = "Sum of syrups: ", SourceField = "Product" });