Infragistics(R) NetAdvantage(R) Windows Forms
GroupBySummaryDisplayStyle Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridOverride Class : GroupBySummaryDisplayStyle Property

Specifies how summaries in group-by rows are displayed.

Syntax

Visual Basic (Declaration) 
Public Property GroupBySummaryDisplayStyle As GroupBySummaryDisplayStyle
C# 
public GroupBySummaryDisplayStyle GroupBySummaryDisplayStyle {get; set;}

Example

Following code sets some of the row summaries functionality related properties.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        ' To allow the user to be able to add/remove summaries set the 
        ' AllowRowSummaries property. This does not have to be set to summarize
        ' data in code.
        e.Layout.Override.AllowRowSummaries = AllowRowSummaries.True

        ' Here is how you can add summary of a column in code. The retruned 
        ' SummarySettings object has properties for specifying the appearance,
        ' visibility and where it's displayed among other things.
        Dim columnToSummarize As UltraGridColumn = e.Layout.Bands(0).Columns("Total")
        Dim summary As SummarySettings = e.Layout.Bands(0).Summaries.Add("GrandTotal", SummaryType.Sum, columnToSummarize)
        summary.DisplayFormat = "Total = {0:c}"
        summary.Appearance.TextHAlign = HAlign.Right

        ' To display summary footer on the top of the row collections set the 
        ' SummaryDisplayArea property to a value that has the Top or TopFixed flag
        ' set. TopFixed will make the summary fixed (non-scrolling). Note that 
        ' summaries are not fixed in the child rows. TopFixed setting behaves
        ' the same way as Top in child rows. Default is resolved to Bottom (and
        ' InGroupByRows more about which follows).
        e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.TopFixed

        ' By default UltraGrid does not display summary footers or headers of
        ' group-by row islands. To display summary footers or headers of group-by row
        ' islands set the SummaryDisplayArea to a value that has GroupByRowsFooter
        ' flag set.
        e.Layout.Override.SummaryDisplayArea = e.Layout.Override.SummaryDisplayArea Or SummaryDisplayAreas.GroupByRowsFooter

        ' If you want to to display summaries of child rows in each group-by row
        ' set the SummaryDisplayArea to a value that has SummaryDisplayArea flag
        ' set. If SummaryDisplayArea is left to Default then the UltraGrid by
        ' default displays summaries in group-by rows.
        e.Layout.Override.SummaryDisplayArea = e.Layout.Override.SummaryDisplayArea Or SummaryDisplayAreas.InGroupByRows

        ' SummaryDisplayArea property is expossed on the SummarySettings object as
        ' well allowing to control if and where the summary gets displayed on a
        ' per summary basis.
        summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed _
                                        Or SummaryDisplayAreas.GroupByRowsFooter

        ' By default any summaries to be displayed in the group-by rows are displayed
        ' as text appended to the group-by row's description. You can set the 
        ' GroupBySummaryDisplayStyle property to SummaryCells or 
        ' SummaryCellsAlwaysBelowDescription to display summary values as a separate
        ' ui element (cell like element with border, to which the summary value related
        ' appearances are applied). Default value of GroupBySummaryDisplayStyle is resolved
        ' to Text.
        e.Layout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells

        ' Appearance of the summary area can be controlled using the 
        ' SummaryFooterAppearance. Even though the property's name contains the
        ' word 'footer', this appearance applies to summary area that is displayed
        ' on top as well (summary headers).
        e.Layout.Override.SummaryFooterAppearance.BackColor = SystemColors.Info

        ' Appearance of summary values can be controlled using the 
        ' SummaryValueAppearance property.
        e.Layout.Override.SummaryValueAppearance.BackColor = SystemColors.Window
        e.Layout.Override.SummaryValueAppearance.FontData.Bold = DefaultableBoolean.True

        ' Appearance of summary values that are displayed inside of group-by rows can 
        ' be controlled using the GroupBySummaryValueAppearance property. Note that
        ' this has effect only when the GroupBySummaryDisplayStyle is set to SummaryCells
        ' or SummaryCellsAlwaysBelowDescription.
        e.Layout.Override.GroupBySummaryValueAppearance.BackColor = SystemColors.Window
        e.Layout.Override.GroupBySummaryValueAppearance.TextHAlign = HAlign.Right

        ' Caption of the summary area can be set using the SummaryFooterCaption
        ' proeprty of the band.
        e.Layout.Bands(0).SummaryFooterCaption = "Grand Totals:"

        ' Caption's appearance can be controlled using the SummaryFooterCaptionAppearance
        ' property.
        e.Layout.Override.SummaryFooterCaptionAppearance.FontData.Bold = DefaultableBoolean.True

        ' By default summary footer caption is visible. You can hide it using the
        ' SummaryFooterCaptionVisible property.
        e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False

        ' SummaryFooterSpacingAfter and SummaryFooterSpacingBefore properties can be used
        ' to leave spacing before and after the summary footer.
        e.Layout.Override.SummaryFooterSpacingAfter = 5
        e.Layout.Override.SummaryFooterSpacingBefore = 5
    End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void UltraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// To allow the user to be able to add/remove summaries set the 
			// AllowRowSummaries property. This does not have to be set to summarize
			// data in code.
			e.Layout.Override.AllowRowSummaries = AllowRowSummaries.True;

			// Here is how you can add summary of a column in code. The retruned 
			// SummarySettings object has properties for specifying the appearance,
			// visibility and where it's displayed among other things.
			UltraGridColumn columnToSummarize = e.Layout.Bands[0].Columns["Total"];
			SummarySettings summary = e.Layout.Bands[0].Summaries.Add( "GrandTotal", SummaryType.Sum, columnToSummarize );
			summary.DisplayFormat = "Total = {0:c}";
			summary.Appearance.TextHAlign = HAlign.Right;

			// To display summary footer on the top of the row collections set the 
			// SummaryDisplayArea property to a value that has the Top or TopFixed flag
			// set. TopFixed will make the summary fixed (non-scrolling). Note that 
			// summaries are not fixed in the child rows. TopFixed setting behaves
			// the same way as Top in child rows. Default is resolved to Bottom (and
			// InGroupByRows more about which follows).
			e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.TopFixed;

			// By default UltraGrid does not display summary footers or headers of
			// group-by row islands. To display summary footers or headers of group-by row
			// islands set the SummaryDisplayArea to a value that has GroupByRowsFooter
			// flag set.
			e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.GroupByRowsFooter;

			// If you want to to display summaries of child rows in each group-by row
			// set the SummaryDisplayArea to a value that has SummaryDisplayArea flag
			// set. If SummaryDisplayArea is left to Default then the UltraGrid by
			// default displays summaries in group-by rows.
			e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.InGroupByRows;

			// SummaryDisplayArea property is expossed on the SummarySettings object as
			// well allowing to control if and where the summary gets displayed on a
			// per summary basis.
			summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed 
				| SummaryDisplayAreas.GroupByRowsFooter;

			// By default any summaries to be displayed in the group-by rows are displayed
			// as text appended to the group-by row's description. You can set the 
			// GroupBySummaryDisplayStyle property to SummaryCells or 
			// SummaryCellsAlwaysBelowDescription to display summary values as a separate
			// ui element (cell like element with border, to which the summary value related
			// appearances are applied). Default value of GroupBySummaryDisplayStyle is resolved
			// to Text.
			e.Layout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells;

			// Appearance of the summary area can be controlled using the 
			// SummaryFooterAppearance. Even though the property's name contains the
			// word 'footer', this appearance applies to summary area that is displayed
			// on top as well (summary headers).
			e.Layout.Override.SummaryFooterAppearance.BackColor = SystemColors.Info;

			// Appearance of summary values can be controlled using the 
			// SummaryValueAppearance property.
			e.Layout.Override.SummaryValueAppearance.BackColor = SystemColors.Window;
			e.Layout.Override.SummaryValueAppearance.FontData.Bold = DefaultableBoolean.True;

			// Appearance of summary values that are displayed inside of group-by rows can 
			// be controlled using the GroupBySummaryValueAppearance property. Note that
			// this has effect only when the GroupBySummaryDisplayStyle is set to SummaryCells
			// or SummaryCellsAlwaysBelowDescription.
			e.Layout.Override.GroupBySummaryValueAppearance.BackColor = SystemColors.Window;
			e.Layout.Override.GroupBySummaryValueAppearance.TextHAlign = HAlign.Right;

			// Caption of the summary area can be set using the SummaryFooterCaption
			// proeprty of the band.
			e.Layout.Bands[0].SummaryFooterCaption = "Grand Totals:";

			// Caption's appearance can be controlled using the SummaryFooterCaptionAppearance
			// property.
			e.Layout.Override.SummaryFooterCaptionAppearance.FontData.Bold = DefaultableBoolean.True;

			// By default summary footer caption is visible. You can hide it using the
			// SummaryFooterCaptionVisible property.
			e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;

			// SummaryFooterSpacingAfter and SummaryFooterSpacingBefore properties can be used
			// to leave spacing before and after the summary footer.
			e.Layout.Override.SummaryFooterSpacingAfter = 5;
			e.Layout.Override.SummaryFooterSpacingBefore = 5;
		}

Remarks

Specifies how summaries in group-by rows are displayed.

See Also