alexa
Syncfusion
menu Syncfusion

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class DataGridSummaryColumn

    Represents a class that defines the summary calculation based on a column.

    Inheritance
    object
    DataGridSummaryColumn
    Implements
    ISummaryColumn
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Maui.DataGrid
    Assembly: Syncfusion.Maui.DataGrid.dll
    Syntax
    public class DataGridSummaryColumn : ISummaryColumn, IDisposable

    Constructors

    DataGridSummaryColumn()

    Declaration
    public DataGridSummaryColumn()

    Properties

    CustomAggregate

    Gets or sets the custom aggregate of the DataGridSummaryColumn.

    Declaration
    public ISummaryAggregate? CustomAggregate { get; set; }
    Property Value
    Type
    ISummaryAggregate
    Remarks

    DataGrid provides the built in aggregate types for calculating the values for the summary column in the SummaryType of theDataGridSummaryColumn.The user can implement their own aggregate function when the built in aggregate function does not meet his requirement using this property.When the user defines his own aggregate function in the CustomAggregate, set the SummaryType as Custom.

    Examples
    <ContentPage.Resources>
    <local:CustomAggregate x:Key="customAggregate"></local:CustomAggreate>
    </ContentPage.Resources>
    <sfGrid:SfDataGrid.TableSummaryRows>    
    <sfGrid:DataGridTableSummaryRow Title="Standard Deviation:{TableSummary}" ShowSummaryInRow = "True">                                                            
    <sfGrid:DataGridTableSummaryRow.SummaryColumns>            
    <sfGrid:DataGridSummaryColumn Name="TableSummary" CustomAggregate="{StaticResource customAggregate}"    Format="{{StdDev}" MappingName="OrderID" SummaryType="Custom"/>        
    </sfGrid:DataGridTableSummaryRow.SummaryColumns>    
    </sfGrid:DataGridTableSummaryRow>
     public class CustomAggregate : ISummaryAggregate
     {
     public CustomAggregate()
      {
     }
     public double StdDev { get; set; }
     public Action<System.Collections.IEnumerable, string, System.ComponentModel.PropertyDescriptor>  CalculateAggregateFunc()
     {
      return (items, property, pd) =>
     {
     var enumerableItems = items as IEnumerable<OrderInfo>;
                   if (pd.Name == "StdDev")
                {
                 this.StdDev = enumerableItems.StdDev<OrderInfo>(q => q.OrderID);
           }
       };
     }
      }
     public static class LinqExtensions
     {
      public static double StdDev<T>(this IEnumerable<T> values, Func<T, double?> selector)
     {
      double value = 0;
    var count = values.Count();
    if (count > 0)
                {
                 double? avg = values.Average(selector);
              double sum = values.Select(selector).Sum(d =>
           {
            if (d.HasValue)
         {
          return Math.Pow(d.Value - avg.Value, 2);
     }
      return 0.0;
     });
     value = Math.Sqrt((sum) / (count - 1));
    }
       return value;
      }
     }
     <syncfusion:DataGridSummaryColumn Name="TotalSalary"
    Format="{}{Sum:C0}"
     MappingName="Salary"
    SummaryType="Custom" />

    DependentColumnNames

    Gets or sets the dependent column names for this summary column. It refreshes the summary column data when any value of its dependent columns is changed.

    Declaration
    public string? DependentColumnNames { get; set; }
    Property Value
    Type
    string

    Format

    Gets or sets the format to be applied to the summary value. The user can format the summary value by setting the appropriate format after the aggregate function followed by a colon(:) in this property.

    Declaration
    public string? Format { get; set; }
    Property Value
    Type
    string

    MappingName

    Gets or sets the MappingName column, that is used for summary calculation.

    Declaration
    public string? MappingName { get; set; }
    Property Value
    Type
    string

    Name

    Gets or sets the name of the summary column that helps to denote the DataGridSummaryColumn in Title

    Declaration
    public string? Name { get; set; }
    Property Value
    Type
    string

    SummaryMode

    Gets or sets a value that decides whether summary calculation is processed based on display value in case of indexer and complex properties or default value in case of CLR properties of the column.

    Declaration
    public DataReflectionMode SummaryMode { get; set; }
    Property Value
    Type
    DataReflectionMode

    SummaryType

    Gets or sets the type of the summary column for calculating values.

    Declaration
    public SummaryType SummaryType { get; set; }
    Property Value
    Type
    SummaryType
    Remarks

    DataGrid provides the built in aggregate types for calculating the values for the summary column in the SummaryType.User can implement their own aggregate function when the built in aggregate function does not meet his requirement using CustomAggregate property.

    Template

    Gets or sets the template that is used to display the contents of a DataGridSummaryColumn.

    Declaration
    public DataTemplate? Template { get; set; }
    Property Value
    Type
    DataTemplate

    Methods

    Dispose()

    Releases the resources used by the component.

    Declaration
    public void Dispose()

    Dispose(bool)

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    Implements

    ISummaryColumn
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved