Winforms – Devexpress Total Sum Summary cell is blank and wont display summary

devexpresssumsummarywinformsxtragrid

I have a Devexpress XtraGrid with a total summary cell in the footer.

The cell is displayed correctly, but there is no value in it.
I have:
Grid.OptionsView.ShowFooter = true and Grid.OptionsBehavior.AutoUpdateTotalSummary = true.

In the column where I want the total sum I have:
Col.SummaryItem.FieldName = col.FieldName and col.SummaryItem.SummaryType = Sum and col.SummaryItem.DIsplayFormat = ${0}

The summery cell never shows a value.
If right click on the summary cell and then select Sum the summary value shows up and works correctly. But I need to work without the user needing to right click on the cell and select Sum.
Any help would be appreciated. Thanks 🙂

Best Answer

The following code works fine to me, so I believe that there is something wrong in your source code:

using DevExpress.Data;
using DevExpress.XtraGrid;
//...
colUnitPrice.FieldName = "UnitPrice";
colUnitPrice.Name = "colUnitPrice";
colUnitPrice.Summary.AddRange(new GridSummaryItem[] {
    new GridColumnSummaryItem(SummaryItemType.Sum, "UnitPrice", "${0}")});

Please, check your source code again (don't forget to review the Total Summary article) or provide us with more details on this issue.