Can you please advise how to archive below Ive found somwhere in web ?I know how to show summaries in group by rows but those are presented that way:
But need sums to be in right columns not "glued" to items count label
This is what I need
Part of my code My code:
var summary = ultGrid.DisplayLayout.Bands[0].Summaries.Add ( sumGroupName + "_" + ultGrid.DisplayLayout.Bands[0].Summaries.Count , formula, position, columnPosition); summary.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows | SummaryDisplayAreas.HideDataRowFooters;
Just set the GroupByRowSummaryDisplayStyle property to GroupBySummaryDisplayStyle.SummaryCells.
https://es.infragistics.com/help/winforms/infragistics.win.ultrawingrid~infragistics.win.ultrawingrid.groupbysummarydisplaystyle
One more question is - how force standard summaries (available via sigma button) to be shown in GroupByRows ?
I'm afraid I don't understand what you are asking. Can you explain in more detail?
Apologies being not precise.
I meant - where I can setup layout of default summaries available by pressing sigma icon on headersI can setup all I need (eg SummaryDisplayArea , DisplayFormat etc) but only when I add my own summaries, eg that way:
var summary = ultGrid.DisplayLayout.Bands[0].Summaries.Add ( sumGroupName + "_" + ultGrid.DisplayLayout.Bands[0].Summaries.Count , formula, position, columnPosition);summary.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows | SummaryDisplayAreas.HideDataRowFooters;
I m looking way to set similar features for 'default' summaries (MIN / MAX / SUM) etc
Oh, I see.
The sample code is doing something kind've odd, which is that it's setting the SummaryDisplayArea on each individual SummarySettings. But that's probably not what you want. You probably just want to set that as the default for ALL summaries in your grid, so that it includes new ones added by the user and you only have to set it once.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { var layout = e.Layout; var ov = layout.Override; ov.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells; ov.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows | SummaryDisplayAreas.HideDataRowFooters; }
Thanks Mike,
I might do that wrongly. Indeed Display Style / Area works way you described
But how to set DisplayFormat ? I cant see such property using layout.Override
(I need to setup thousands separator + decimal places precision - usually "N2")
There's no Override-level setting for DisplayFormat. That has to be set on each SummarySettings individually.
So what you can do is handle that in the AfetrSummaryDialog event. Basically something like this:
private void UltraGrid1_AfterSummaryDialog(object sender, AfterSummaryDialogEventArgs e) { if (e.SummariesChanged) { foreach (SummarySettings summary in e.Column.Band.Summaries) { if (summary.SourceColumn == e.Column) { switch (summary.SummaryType) { case SummaryType.Average: summary.DisplayFormat = "Average = {0:##.##}"; break; case SummaryType.Count: summary.DisplayFormat = "Count = {0}"; break; } } } } }
Many thanks this was exactly what I needed!
Can close topic.