Exception with Sum AggregateFuntion
PROBLEM
You declare an aggregate SumFunction for a column:
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:SumFunction/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
CAUSE
You can sum only Numeric types.
SOLUTION
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()
};
playersGrid.Columns[0].AggregateFunctions.Add(aggregate);