Search code examples
suminfragisticsultrawingrid

How can I show a summary in the footer of a win grid and not have the Sigma show up in the header?


I'm using an Infragistics UltraWinGrid and would like to be able to display the sum of several columns. I got that working by allowing row summaries. However, I only want them to be able to see the sum, not have all these other crazy options that come along with that little sigma in the header. How can I get rid of this while keeping the sums at the bottom?


Solution

  • You should have the DisplayLayout.Override.AllowRowSummaries property set in this way:

    DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.Default;
    

    then use code like this to create your summary (Need to check before creating another summary with the same name)

    private void BuildCurrencySummary(string name, UltraGridColumn col)
    {
        SummarySettings ss = grd.DisplayLayout.Bands[0].Summaries.Add(name, SummaryType.Sum, col);
        ss.SummaryPositionColumn = col;
        ss.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
        ss.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
        ss.Appearance.ForeColor = Color.Black;
        ss.Appearance.TextHAlign = HAlign.Right;
        ss.DisplayFormat = "{0:C}";
    }