Class GridSummaryColumn
Represents a class that implements ISummaryColumn that contains properties exposed through ISummaryColumn for getting information on the summary values to be computed for the Groups.
Inheritance
Namespace: Syncfusion.SfDataGrid.XForms
Assembly: Syncfusion.SfDataGrid.XForms.dll
Syntax
public class GridSummaryColumn : Object, ISummaryColumn, IDisposable
Constructors
GridSummaryColumn()
Initializes a new instance of the GridSummaryColumn class.
Declaration
public GridSummaryColumn()
Properties
CustomAggregate
Gets or sets the custom aggregate of the GridSummary column. SfDataGrid provides the built in aggregate types for calculating the values for the GridSummary column in the SummaryType of the GridSummaryColumn. 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, he needs to set the SummaryType as Custom.
Declaration
public ISummaryAggregate CustomAggregate { get; set; }
Property Value
Type | Description |
---|---|
ISummaryAggregate | The custom aggregate of the GridSummary column. |
Remarks
SfDataGrid allows you to implement your own aggregate functions, when the built-in aggregate functions do not meet your requirement.The user can calculate the summary values based on custom logic using this property. When the user defines his own aggregate function in the CustomAggregate, he needs to set the SummaryType as Custom.
Examples
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "CaptionSummary",
CustomAggregate = new CustomAggregate(),
MappingName = "OrderID",
SummaryType = SummaryType.Custom
});
sfGrid.CaptionSummaryRow= summaryRow;
//CustomAggregate.cs
public class CustomAggregate : ISummaryAggregate
{
}
See Also
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 Format property.
Declaration
public string Format { get; set; }
Property Value
Type | Description |
---|---|
System.String | The format to be applied to the summary value. |
Examples
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "CaptionSummary",
MappingName = "Salary",
Format = "{Sum:c}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.CaptionSummaryRow= summaryRow;
See Also
MappingName
Gets or sets the mapping name of the summary column, that is used for summary calculation.
Declaration
public string MappingName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The column name to be used for summary calculation. |
Examples
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "CaptionSummary",
MappingName = "Salary",
Format = "{Sum:c}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.CaptionSummaryRow= summaryRow;
See Also
Name
Gets or sets the name of the summary column that helps to denote the GridSummaryColumn in Title. The user can format the summary value for row using Title when ShowSummaryInRow set to true.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the summary column. |
Remarks
The caption of the summary can be displayed either in the summary row or summary column, if the caption is displayed in the summary row by setting ShowSummaryInRow as true. The summary row defines the Title which makes use of the Name to display its value.
Examples
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.ShowSummaryInRow = true;
summaryRow.Title = "Total Salary:{TotalSalary}";
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "TotalSalary",
MappingName = "Salary",
Format = "{Sum:c}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.CaptionSummaryRow= summaryRow;
See Also
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 | Description |
---|---|
DataReflectionMode | The DataReflectionMode that decides whether summary calculation is processed based on display value or default value. The default value is Default. |
Remarks
By default, the summary for the column will be calculated using DataReflectionMode Default only. For complex properties use DataReflectionMode.Display to fetch values using custom logic. For simple CLR properties use DataReflectionMode.Default to fetch values using default logic. DataReflectionMode.Value is not applicable for the summary column.
Examples
GridTableSummaryRow summaryRow1 = new GridTableSummaryRow();
summaryRow1.SummaryColumns.Add(new GridSummaryColumn()
{
Name = "TotalSalary",
MappingName = "OrderID[0]",
Format = "{Sum:c}",
SummaryType = SummaryType.DoubleAggregate,
SummaryMode = DataReflectionMode.Display
}
sfGrid.TableSummaryRows.Add(summaryRow);
SummaryType
Gets or sets a value indicating the summary type of the GridSummary column for calculating values of the GridSummary column. SfDataGrid provides the built in aggregate types for calculating the values for the GridSummary column in the SummaryType. The user can implement their own aggregate function when the built in aggregate function does not meet his requirement using CustomAggregate property.
Declaration
public SummaryType SummaryType { get; set; }
Property Value
Type | Description |
---|---|
SummaryType | The SummaryType of the summary column. |
Remarks
SfDataGrid provides the built in aggregate types for calculating the values for the GridSummary column in the SummaryType. The user can implement their own aggregate function when the built in aggregate function does not meet his requirement using CustomAggregate property.
Examples
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "TotalSalary",
MappingName = "Salary",
Format = "{Sum:c}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.CaptionSummaryRow= summaryRow;
See Also
Template
Gets or sets the template that is used to display the contents of a summary column.
Declaration
public DataTemplate Template { get; set; }
Property Value
Type | Description |
---|---|
Xamarin.Forms.DataTemplate | The Xamarin.Forms.DataTemplate that is used to display the contents of a caption summary cell. |
Remarks
SfDataGrid allows the user to customize the GridSummaryColumn with your own view by setting the Template of GridSummaryColumn. To specify the template that is used to display the contents of a caption summary cell, set the Template property. SfDataGrid also allows the user to customize the GridSummaryColumn with different type of views by setting Xamarin.Forms.DataTemplateSelector to the Template.
Examples
<sfgrid:SfDataGrid.CaptionSummaryRow>
<sfgrid:GridSummaryRow Name = "CaptionSummary" ShowSummaryInRow="False" Title="Salary: {CaptionSummary}">
<sfgrid:GridSummaryRow.SummaryColumns>
<sfgrid:GridSummaryColumn Name = "CaptionSummary" Format="{}{Sum}" MappingName="Salary"
SummaryType="DoubleAggregate" >
<syncfusion:GridSummaryColumn.Template>
<DataTemplate>
<Label Text = "Caption Column" TextColor="Black"
XAlign="Center" YAlign="Center" />
</DataTemplate>
</syncfusion:GridSummaryColumn.Template>
</sfgrid:GridSummaryColumn>
</sfgrid:GridSummaryRow.SummaryColumns>
</sfgrid:GridSummaryRow>
</sfgrid:SfDataGrid.CaptionSummaryRow>
Methods
Dispose()
Releases the resources used by the component.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the component and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | if true - release both managed and unmanaged resources; if false - release only unmanaged resources. |