New to Telerik UI for .NET MAUI? Start a free 30-day trial


The DelegateAggregateDescriptor allows you to define property look-up logic and a custom function that are applied over the property values of the DataGrid, which accumulates an aggregated result based on the component data.

To set up the DelegateAggregateDescriptor, use the following properties:

  • ValueLookup—Defines an IKeyLookup instance, which retrieves the value from the underlying ViewModel that is used for computing the aggregated value.
  • Function—Defines an IAggregateFunction instance that performs the aggregation of the values as specified by the ValueLookup property.
  • Format—Defines the string format that will be applied over the aggregated value.

The following example uses the DelegateAggregateDescriptor and a custom implementation for a SumIf function which sums the values in a range that meet a certain criteria:

1. First, create a class that inherits from the IKeyLookup interface. It will return the values of a Price property declared in our business model that is of type double.

public class SumIfKeyLookUp : IKeyLookup
    public object GetKey(object instance) => ((Data)instance).Price; 

2. Then, declare a class that inherits from the IAggregateFunction interface. This class will contain our logic for the SumIf function which we will later implement through XAML:

public class SumIfAggregateFunction : IAggregateFunction
    private double value;
    public double GreaterThanValue { get; set; }

    public object GetValue() => $"SumIf (Price > {this.GreaterThanValue}): " + string.Format("{0:C}", this.value);

    public IAggregateFunction Clone() => new SumIfAggregateFunction() { GreaterThanValue = this.GreaterThanValue };

    public void Accumulate(object value)
        var price = (double)value;
        if (price > this.GreaterThanValue)
            this.value += price;

    public void Merge(IAggregateFunction aggregateFunction)
        var myFunction = aggregateFunction as SumIfAggregateFunction;
        if (myFunction != null)
            this.value += myFunction.value;

3. Declare the DelegateAggregateDescriptor in XAML.

<telerik:RadDataGrid x:Name="dataGrid"
        <telerik:DataGridTextColumn PropertyName="Name" />
        <telerik:DataGridNumericalColumn PropertyName="Price"
                        <local:SumIfAggregateFunction GreaterThanValue="100"/>

Delegate Aggregate Descriptor

See Also

In this article
Not finding the help you need?