KB Article A1101
Visible to All Users

How to show multiple summary values under the same column

Description:
I wish to show several summary values under the same column. How can I do this?

Answer:
NOTE
Starting with version 11.1, GridView supports multiple total summaries in the same view footer cell by default.

This feature can be implemented by using the grid's owner draw abilities. i.e. you should set the View's FooterPanelHeight property to a value that makes it possible to paint two summary items. Then, handle the CustomDrawFooterCell event to paint summary values:

C#
private void Form1_Load(object sender, System.EventArgs e) { //... gridView1.Columns.AddField("Dummy"); gridView1.Columns["Dummy"].UnboundType = DevExpress.Data.UnboundColumnType.Integer; GridSummaryItem si = new GridSummaryItem(DevExpress.Data.SummaryItemType.Average, "CategoryID", ""); gridView1.Columns["Dummy"].SummaryItem.Assign(si); gridView1.Columns["Dummy"].Visible = false; //... } private void gridView1_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) { if(e.Column == colCategoryID) { e.Painter.DrawObject(e.Info); Rectangle r = e.Info.Bounds; string text = e.Info.DisplayText; e.Info.Bounds = new Rectangle(e.Info.Bounds.Left, e.Info.Bounds.Bottom + 1, e.Info.Bounds.Width, e.Info.Bounds.Height); e.Info.DisplayText = view.Columns["Dummy"].SummaryText; e.Painter.DrawObject(e.Info); e.Handled = true; e.Info.Bounds = r; e.Info.DisplayText = text; } else if (e.Column == colCategoryName) e.Handled = true; }

The sample project attached shows this approach in action.
 See also: How to show multiple group summary values in the same group footer cell

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.