menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridSummaryColumnDescriptor - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridSummaryColumnDescriptor

    A GridSummaryColumnDescriptor declares a summary column within a summary row. GridSummaryColumnDescriptor descriptors are managed by the GridSummaryColumnDescriptorCollection which is returned by the SummaryColumns property of a GridSummaryRowDescriptor.

    Inheritance
    System.Object
    ShouldSerializeBasedPersisterType
    DescriptorBase
    GridSummaryColumnDescriptor
    Implements
    System.ComponentModel.ICustomTypeDescriptor
    System.IDisposable
    System.ICloneable
    IStandardValuesProvider
    IGridTableCellAppearanceSource
    Inherited Members
    DescriptorBase.CanResetValue()
    DescriptorBase.Dispose()
    DescriptorBase.Disposed
    DescriptorBase.Disposing
    DescriptorBase.InDisposed
    DescriptorBase.IsDisposed
    DescriptorBase.OnDisposed(EventArgs)
    DescriptorBase.Reset()
    DescriptorBase.ShouldSerialize()
    DescriptorBase.ToString()
    ShouldSerializeBasedPersisterType.AddNewAttributes(PropertyDescriptor, Attribute[], Int32)
    ShouldSerializeBasedPersisterType.CheckAllProperties
    ShouldSerializeBasedPersisterType.GetCustomPDC(PropertyDescriptorCollection)
    ShouldSerializeBasedPersisterType.GetNewAttributesCount(PropertyDescriptor)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Syncfusion.Windows.Forms.Grid.Grouping
    Assembly: Syncfusion.Grid.Grouping.Windows.dll
    Syntax
    public class GridSummaryColumnDescriptor : DescriptorBase, ICustomTypeDescriptor, IDisposable, ICloneable, IStandardValuesProvider, IGridTableCellAppearanceSource
    Remarks

    Each group in the GridTable has a summary section. The summary section has as many rows as there are GridSummaryRowDescriptors that are visible. Each GridSummaryRowDescriptor has a collection of GridSummaryColumnDescriptor columns. The GridSummaryColumnDescriptor defines the GridColumnDescriptor to calculate summary information for the SummaryType and the target column where the summary should be displayed in the grid.

    The following example shows how to set up a summary. See also the grid\grouping\CustomSummary example for setting up custom summaries:

    Examples
    ' Setup an integrated summary
    Dim sd0 As New GridSummaryColumnDescriptor()
    sd0.DataMember = "Quantity"
    sd0.DisplayColumn = "Quantity"
    sd0.Format = "{Average:#.00}"
    sd0.SummaryType = SummaryType.DoubleAggregate
    Me.gridGroupingControl1.TableDescriptor.SummaryRows.Add(New GridSummaryRowDescriptor("Row 0", "Average", sd0))
    

    // Setup an integrated summary GridSummaryColumnDescriptor sd0 = new GridSummaryColumnDescriptor(); sd0.DataMember = "Quantity"; sd0.DisplayColumn = "Quantity"; sd0.Format = "{Average:#.00}"; sd0.SummaryType = SummaryType.DoubleAggregate; this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 0", "Average", sd0));

    Constructors

    GridSummaryColumnDescriptor()

    Initializes a new empty descriptor.

    Declaration
    public GridSummaryColumnDescriptor()

    GridSummaryColumnDescriptor(String)

    Initializes a new descriptor for the specified column (name) in the parent table.

    Declaration
    public GridSummaryColumnDescriptor(string name)
    Parameters
    Type Name Description
    System.String name

    The descriptor name which also identifies the GridColumnDescriptor.

    GridSummaryColumnDescriptor(String, SummaryType, String, String)

    Initializes a new descriptor for the specified column (name) in the parent table, the summary type and the target column where the summary should be displayed.

    Declaration
    public GridSummaryColumnDescriptor(string name, SummaryType summaryType, string dataMember, string format)
    Parameters
    Type Name Description
    System.String name

    The descriptor name.

    SummaryType summaryType

    The summary type.

    System.String dataMember

    The target column at which to display the summary.

    System.String format

    The format string used to format the text to display in the summary column. A format string consists of the PropertyName of the summaryType and a format specifier known from String.Format, e.g. {Average:###.00}.

    Properties

    Appearance

    Gets or sets the default GridTableCellAppearance with default GridTableCellStyleInfo information for all cell elements that display data of this summary column.

    Declaration
    public GridTableCellAppearance Appearance { get; set; }
    Property Value
    Type
    GridTableCellAppearance

    ColInRecord

    Gets or sets the grid column index of the target cell where the summary is displayed.

    Declaration
    public int ColInRecord { get; set; }
    Property Value
    Type
    System.Int32

    Collection

    Gets the collection this descriptor belongs to.

    Declaration
    public GridSummaryColumnDescriptorCollection Collection { get; }
    Property Value
    Type
    GridSummaryColumnDescriptorCollection

    DataMember

    The mapping for this column. You should specify here a field name of a FieldDescriptor ( or GridColumnDescriptor.MappingName)

    Declaration
    public string DataMember { get; set; }
    Property Value
    Type
    System.String

    DisplayColumn

    Gets or sets the target column at which to display the summary.

    Declaration
    public string DisplayColumn { get; set; }
    Property Value
    Type
    System.String

    Engine

    Gets the GridEngine that this summary column descriptor belongs to.

    Declaration
    public GridEngine Engine { get; }
    Property Value
    Type
    GridEngine

    Format

    Gets or sets the format string used to format the text to display in the summary column. A format string consists of the PropertyName of the summaryType and a format specifier known from String.Format, e.g. {Average:###.00}.

    Declaration
    public string Format { get; set; }
    Property Value
    Type
    System.String

    IgnoreRecordFilterCriteria

    Gets or sets a value indicates whether RecordFilter criteria should be ignored and the summary should be calculated for all records.

    Declaration
    public bool IgnoreRecordFilterCriteria { get; set; }
    Property Value
    Type
    System.Boolean

    MaxLength

    Gets or sets a value that specifies the maximum length of the formatted text for this summary column. This value will be used for calculating the optimal width of a column. The default is the length of the Format text plus 5.

    Declaration
    public int MaxLength { get; set; }
    Property Value
    Type
    System.Int32

    Name

    Gets or sets the name of this descriptor. This name is used to look up the summary in the GridSummaryColumnDescriptorCollection.

    Declaration
    public virtual string Name { get; set; }
    Property Value
    Type
    System.String

    ParentRow

    Gets the GridSummaryRowDescriptor this summary column belongs to.

    Declaration
    public GridSummaryRowDescriptor ParentRow { get; }
    Property Value
    Type
    GridSummaryRowDescriptor

    RowInRecord

    Gets or sets the row index relative to the first row in the summary section of a group.

    Declaration
    public int RowInRecord { get; set; }
    Property Value
    Type
    System.Int32

    Style

    Gets or sets whether a summary should fill the entire row, only a column, or if it should be hidden.

    Declaration
    public GridSummaryStyle Style { get; set; }
    Property Value
    Type
    GridSummaryStyle

    SummaryDescriptor

    Gets the SummaryDescriptor that is used for calculating the summaries. The GridEngine internally creates SummaryDescriptors for each GridColumnDescriptor based on the SummaryType and DataMember defined in the GridColumnDescriptor. If SummaryType.Custom was specified, the TableDescriptor.QueryCustomSummary event needs to instantiate the SummaryDescriptor.

    Declaration
    public SummaryDescriptor SummaryDescriptor { get; }
    Property Value
    Type
    SummaryDescriptor

    SummaryType

    Gets or set the type of summary.

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

    TableDescriptor

    Gets the TableDescriptor that this descriptor belongs to.

    Declaration
    public GridTableDescriptor TableDescriptor { get; }
    Property Value
    Type
    GridTableDescriptor

    Methods

    Clone()

    Creates a copy of this descriptor.

    Declaration
    public GridSummaryColumnDescriptor Clone()
    Returns
    Type Description
    GridSummaryColumnDescriptor

    A copy of this descriptor.

    Dispose(Boolean)

    Disposes the objects and collection items.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    DescriptorBase.Dispose(Boolean)

    Equals(Object)

    Determines whether the specified System.Object is equal to the current System.Object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    The System.Object to compare with the current System.Object.

    Returns
    Type Description
    System.Boolean

    true if the specified System.Object is equal to the current System.Object; otherwise, false.

    Overrides
    System.Object.Equals(System.Object)

    GetDisplayText(ITreeTableSummary)

    Returns the display text to be displayed in the summary grid cell given an ISummary.

    Declaration
    public string GetDisplayText(ITreeTableSummary summary)
    Parameters
    Type Name Description
    ITreeTableSummary summary

    The ISummary object with summary values.

    Returns
    Type Description
    System.String

    The text to display in the grid cell.

    GetDisplayText(ITreeTableSummary, Object)

    Returns the display text to be displayed in the summary grid cell given an ISummary.

    Declaration
    public string GetDisplayText(ITreeTableSummary summary, object groupPassThroughItem)
    Parameters
    Type Name Description
    ITreeTableSummary summary

    The ISummary object with summary values.

    System.Object groupPassThroughItem

    The group Pass Through Item.

    Returns
    Type Description
    System.String

    The text to display in the grid cell.

    GetDisplayText(Group)

    Returns the display text to be displayed in the summary grid cell given an ISummary.

    Declaration
    public string GetDisplayText(Group g)
    Parameters
    Type Name Description
    Group g

    The Group with summary values.

    Returns
    Type Description
    System.String

    The text to display in the grid cell.

    GetDisplayText(Table, GridSummaryRow)

    Returns the display text to be displayed in the summary grid cell using the calculated summary value for that specific run-time row element in the table.

    Declaration
    public string GetDisplayText(Table table, GridSummaryRow row)
    Parameters
    Type Name Description
    Table table

    The parent table.

    GridSummaryRow row

    The row in the table.

    Returns
    Type Description
    System.String

    The text to display in the grid cell.

    Examples

    These code snippets demonstrates different alternatives to get to the summary text (strong typed vs GridSummaryColumnDescriptor.Format)

    // Calling this method to demonstrate different alternatives to get to the summary text string summaryText = GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage");

    // Easier is to simple call built-in routine: string summaryText = GridEngine.GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage");

    ///

    /// Demonstrates different alternatives to get to the summary text (strong typed vs GridSummaryColumnDescriptor.Format) /// public string GetSummaryText(Group group, string summaryRowName, string summaryColumnName) { GridTable table = (GridTable) group.ParentTable; GridTableDescriptor td = table.TableDescriptor; GridSummaryRowDescriptor srd = td.SummaryRows[summaryRowName]; GridSummaryColumnDescriptor scd = srd.SummaryColumns[summaryColumnName];

    return GetSummaryText(group, scd); }

    ///

    /// Demonstrates different alternatives to get to the summary text (strong typed vs GridSummaryColumnDescriptor.Format) /// string GetSummaryText(Group group, GridSummaryColumnDescriptor scd) { GridTable table = (GridTable) group.ParentTable; GridTableDescriptor td = table.TableDescriptor;

    string summaryText = string.Empty;

    bool use31Code = true; if (use31Code) { if (scd != null) { // Option 1: GetDisplayText - this is actually the code used when you simply would call // e.Style.Text = ((GridTable) table).GetSummaryText(group, "SummaryRow 1", "FreightAverage"); // // Text is formatted as defined in GridSummaryColumnDescriptor.Format summaryText = scd.GetDisplayText(group);

    // or Option 2: Strong typed access to DoubleAggregateSummary. DoubleAggregateSummary summary1 = (DoubleAggregateSummary) group.GetSummary(scd.SummaryDescriptor); summaryText = string.Format("{0:c}", summary1.Average);

    // or Option 3: Use reflection to get "Average" property of summary summaryText = string.Format("{0:c}", group.GetSummaryProperty(scd.SummaryDescriptor, "Average")); }

    } else { // This is the code you had to use in version 3.0 and earlier (still working but bit more complicate) if (scd != null) { SummaryDescriptor sd1 = scd.SummaryDescriptor; if (sd1 != null) { int indexOfSd1 = table.TableDescriptor.Summaries.IndexOf(sd1);

    ISummary sum1 = group.GetSummaries(table)[indexOfSd1]; string text1 = scd.GetDisplayText(sum1); summaryText = text1;

    // - or - (access value directly) // strong typed - you have to cast to Int32AggregateSummary.

    DoubleAggregateSummary summary1 = (DoubleAggregateSummary) group.GetSummaries(table)[indexOfSd1]; summaryText = string.Format("{0:c}", summary1.Average); } } }

    return summaryText; }

    ' Calling this method to demonstrate different alternatives to get to the summary text
    summaryText = GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage")
    

    ' Easier is to simple call built-in routine: summaryText = GridEngine.GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage")

    '/

    '/ Demonstrates different alternatives to get to the summary text (strong typed vs GridSummaryColumnDescriptor.Format) '/ Public Function GetSummaryText(ByVal group As Group, ByVal summaryRowName As String, ByVal summaryColumnName As String) As String Dim table As GridTable = CType(group.ParentTable, GridTable) Dim td As GridTableDescriptor = table.TableDescriptor Dim srd As GridSummaryRowDescriptor = td.SummaryRows(summaryRowName) Dim scd As GridSummaryColumnDescriptor = srd.SummaryColumns(summaryColumnName)

    Return GetSummaryText(group, scd) End Function 'GetSummaryText

    '/

    '/ Demonstrates different alternatives to get to the summary text (strong typed vs GridSummaryColumnDescriptor.Format) '/ Function GetSummaryText(ByVal group As Group, ByVal scd As GridSummaryColumnDescriptor) As String Dim table As GridTable = CType(group.ParentTable, GridTable) Dim td As GridTableDescriptor = table.TableDescriptor

    Dim summaryText As String = string.Empty

    Dim use31Code As Boolean = True If use31Code Then If Not (scd Is Nothing) Then ' Option 1: GetDisplayText - this is actually the code used when you simply would call ' e.Style.Text = ((GridTable) table).GetSummaryText(group, "SummaryRow 1", "FreightAverage"); ' ' Text is formatted as defined in GridSummaryColumnDescriptor.Format summaryText = scd.GetDisplayText(group)

    ' or Option 2: Strong typed access to DoubleAggregateSummary. Dim summary1 As DoubleAggregateSummary = CType(group.GetSummary(scd.SummaryDescriptor), DoubleAggregateSummary) summaryText = String.Format("{0:c}", summary1.Average)

    ' or Option 3: Use reflection to get "Average" property of summary summaryText = String.Format("{0:c}", group.GetSummaryProperty(scd.SummaryDescriptor, "Average")) End If

    Else ' This is the code you had to use in version 3.0 and earlier (still working but bit more complicate) If Not (scd Is Nothing) Then Dim sd1 As SummaryDescriptor = scd.SummaryDescriptor If Not (sd1 Is Nothing) Then Dim indexOfSd1 As Integer = table.TableDescriptor.Summaries.IndexOf(sd1)

    Dim sum1 As Syncfusion.Collections.BinaryTree.ITreeTableSummary = group.GetSummaries(table)(indexOfSd1) Dim text1 As String = scd.GetDisplayText(sum1) summaryText = text1

    ' - or - (access value directly) ' strong typed - you have to cast to Int32AggregateSummary. Dim summary1 As DoubleAggregateSummary = CType(group.GetSummaries(table)(indexOfSd1), DoubleAggregateSummary) summaryText = String.Format("{0:c}", summary1.Average) End If End If End If

    Return summaryText End Function 'GetSummaryText

    See Also
    GridEngine
    Group
    Group

    GetHashCode()

    Serves as a hash function for a particular type.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A hash code for the current object.

    Overrides
    System.Object.GetHashCode()

    GetName()

    Gets the name of the descriptor.

    Declaration
    public override string GetName()
    Returns
    Type Description
    System.String

    Descriptor name.

    Overrides
    DescriptorBase.GetName()

    GetSummary(Table, Element)

    Returns the calculated summary value for a specific run-time row element in the table.

    Declaration
    public ITreeTableSummary GetSummary(Table table, Element row)
    Parameters
    Type Name Description
    Table table

    The parent table.

    Element row

    The row in the table.

    Returns
    Type Description
    ITreeTableSummary

    The ISummary object with summary values.

    GetSummaryDescriptorName()

    Returns the name to be used for the SummaryDescriptor in the Summaries collection. The name is either the SummaryRowDescriptorName.SummaryColumnDescriporName or DataMember.SummaryType depending on whether a Name was specified for this SummaryColumnDescriptor or not.

    Declaration
    public string GetSummaryDescriptorName()
    Returns
    Type Description
    System.String

    Summary descriptor name.

    GetSummaryIndex()

    Gets the index that can be used to look up summary values from the array returned by GetSummaryIndex() of the Table. Table.GetSummaries returns summaries in the same order as the SummaryDescriptors were added to the TableDescriptor.

    Declaration
    public int GetSummaryIndex()
    Returns
    Type Description
    System.Int32

    An integer index to look up summary values from a summary array.

    InitializeFrom(GridSummaryColumnDescriptor)

    Initializes this object and copies properties from another object. PropertyChanging and PropertyChanged events are raised for every property that is modified. If both objects are equal, no events are raised.

    Declaration
    public void InitializeFrom(GridSummaryColumnDescriptor other)
    Parameters
    Type Name Description
    GridSummaryColumnDescriptor other

    The source object.

    OnPropertyChanged(DescriptorPropertyChangedEventArgs)

    Raises the PropertyChanged event.

    Declaration
    protected virtual void OnPropertyChanged(DescriptorPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    DescriptorPropertyChangedEventArgs e

    A DescriptorPropertyChangedEventArgs that contains the event data.

    OnPropertyChanging(DescriptorPropertyChangedEventArgs)

    Raises the PropertyChanging event.

    Declaration
    protected virtual void OnPropertyChanging(DescriptorPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    DescriptorPropertyChangedEventArgs e

    A DescriptorPropertyChangedEventArgs that contains the event data.

    ResetAppearance()

    Discards any changes for the Appearance object.

    Declaration
    public void ResetAppearance()

    ResetDisplayColumn()

    Discards any changes for the DisplayColumn property.

    Declaration
    public void ResetDisplayColumn()

    ResetMaxLength()

    Discards any changes for MaxLength.

    Declaration
    public void ResetMaxLength()

    ResetStyle()

    Discards any changes for the Style property.

    Declaration
    public void ResetStyle()

    ShouldSerializeAppearance()

    Determines whether Appearance has been modified and its contents should be serialized at design-time.

    Declaration
    public bool ShouldSerializeAppearance()
    Returns
    Type Description
    System.Boolean

    True if contents were changed; False otherwise.

    ShouldSerializeDisplayColumn()

    Determines whether DisplayColumn has been modified and its value should be serialized at design-time.

    Declaration
    public bool ShouldSerializeDisplayColumn()
    Returns
    Type Description
    System.Boolean

    True if contents were changed; False otherwise.

    ShouldSerializeMaxLength()

    Determines whether MaxLength has been modified and should be serialized at design-time.

    Declaration
    public bool ShouldSerializeMaxLength()
    Returns
    Type Description
    System.Boolean

    true if contents were changed; false otherwise.

    ShouldSerializeStyle()

    Determines whether Style has been modified and its value should be serialized at design-time.

    Declaration
    public bool ShouldSerializeStyle()
    Returns
    Type Description
    System.Boolean

    True if contents were changed; False otherwise.

    Events

    PropertyChanged

    Occurs when a property is changed.

    Declaration
    public event DescriptorPropertyChangedEventHandler PropertyChanged
    Event Type
    Type
    DescriptorPropertyChangedEventHandler

    PropertyChanging

    Occurs before a property is changed.

    Declaration
    public event DescriptorPropertyChangedEventHandler PropertyChanging
    Event Type
    Type
    DescriptorPropertyChangedEventHandler

    Explicit Interface Implementations

    IStandardValuesProvider.GetStandardValues(PropertyDescriptor)

    Declaration
    ICollection IStandardValuesProvider.GetStandardValues(PropertyDescriptor propertyDescriptor)
    Parameters
    Type Name Description
    System.ComponentModel.PropertyDescriptor propertyDescriptor
    Returns
    Type
    System.Collections.ICollection

    IGridTableCellAppearanceSource.GetAppearance()

    Declaration
    GridTableCellAppearance IGridTableCellAppearanceSource.GetAppearance()
    Returns
    Type
    GridTableCellAppearance

    IGridTableCellAppearanceSource.GetBaseAppearance()

    Declaration
    GridTableCellAppearance IGridTableCellAppearanceSource.GetBaseAppearance()
    Returns
    Type
    GridTableCellAppearance

    IGridTableCellAppearanceSource.RaiseAppearanceChanged(GridTableCellStyleInfoChangedEventArgs)

    Declaration
    void IGridTableCellAppearanceSource.RaiseAppearanceChanged(GridTableCellStyleInfoChangedEventArgs e)
    Parameters
    Type Name Description
    GridTableCellStyleInfoChangedEventArgs e

    IGridTableCellAppearanceSource.RaiseAppearanceChanging(GridTableCellStyleInfoChangedEventArgs)

    Declaration
    void IGridTableCellAppearanceSource.RaiseAppearanceChanging(GridTableCellStyleInfoChangedEventArgs e)
    Parameters
    Type Name Description
    GridTableCellStyleInfoChangedEventArgs e

    ICloneable.Clone()

    Declaration
    object ICloneable.Clone()
    Returns
    Type
    System.Object

    Implements

    System.ComponentModel.ICustomTypeDescriptor
    System.IDisposable
    System.ICloneable
    IStandardValuesProvider
    IGridTableCellAppearanceSource
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved