Skip to main content

CustomSummaryEventArgs.FieldValue Property

Gets the processed field value.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

Declaration

public object FieldValue { get; }

Property Value

Type Description
Object

An object that specifies the processed field value.

Remarks

Default summary calculation algorithms process values of a field that a summary item specifies (GridColumnSummary.FieldName). This column’s values are passed to the CalculateCustomSummary event handler as the FieldValue parameter. Use this parameter to access the processed value immediately and update TotalValue.

If you need to include several fields in your summary calculations, use the CustomSummaryEventArgs.Item parameter to identify the row being processed and access its values, or call the CustomSummaryEventArgs.GetValue method with the specified field name.

Example

This example demonstrates how to use predefined aggregate functions and custom rule to calculate group and total summaries for grid columns.

Data Summaries

  • Set the group summary to display the maximum Total value for each group of records.
  • Set the total summary to calculate the sum of values in the Total column.
  • Set the custom total summary to count the number of orders whose value in the Shipped column is false (to count orders that are not shipped).
<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Orders}" 
                 CalculateCustomSummary="OnCalculateCustomSummary">
    <!-- ... -->
    <dxg:DataGridView.GroupSummaries>
        <dxg:GridColumnSummary FieldName="Total" Type="Max"/>
    </dxg:DataGridView.GroupSummaries>

    <dxg:DataGridView.TotalSummaries>
        <dxg:GridColumnSummary FieldName="Total" Type="Sum" 
                               DisplayFormat="Total: {0:C0}"/>
        <dxg:GridColumnSummary FieldName="Shipped" Type="Custom" 
                               DisplayFormat="Not Shipped: {0}"/>
    </dxg:DataGridView.TotalSummaries>
</dxg:DataGridView>
int count;
// ...

void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) {
    if (e.FieldName.ToString () == "Shipped")
        if (e.IsTotalSummary){
            if (e.SummaryProcess == CustomSummaryProcess.Start) {
                count = 0;
            }
            if (e.SummaryProcess == CustomSummaryProcess.Calculate) {
                if (!(bool)e.FieldValue)
                    count++;
                e.TotalValue = count;
            }
        }
}
See Also