New to Telerik UI for WPF? Download free 30-day trial

Exception with Sum AggregateFuntion


You declare an aggregate SumFunction for a column:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"> 
As a result, the following error occurs: No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.


You can sum only Numeric types.


You can create a Generic AggregateFunction instead and return the Sum of the values.

You can also specify some custom aggregate expressions. Then add the defined function to the AggregateFunctions collection of GridViewDataColumn as illustrated in this help topic.

For example you can define a generic AggregateFunction which calculates the Sum of the Numbers for all the Players populated in RadGridView. You can refer to the sample code below:

var aggregate = new AggregateFunction<Player, int>() 
    AggregationExpression = players => players.Select(x => x.Number).Sum() 

See Also

In this article