I have a summary row at the bottom of my wingrid, with some extra text the users have required to identify exactly what what being totaled and some totals within that total (I get these by running a Loop for each row).
Anyway, it works great, all my information comes through in the summary row correctly.
The problem I am having is the information is quite a bit wider than the column being totaled. I could widen this column to display the summary correctly, but it leaves the grid looking funny and forces a horizontal scroll bar.
Is there anyway I can widen just the Summary column, and not the entire grid column, or set the summary column to print out expanding over other columns summary fields (which are not being used)?
If not, is there another way I can get around this so that I can display the correct summary information.
Thank you for your help.
T.J.
Hi T.J.,
When you create the summary, you are probably setting it to align to the column it is summarizing. If that's the case, then the summary width will always be the width of the column.
One option would be to specify a location for the summary using an enum instead of a column. There are overloads of the Summaries.Add method that all you to specify that the summary is aligned Right, Left, or Center instead of linking it to the column. This way the summary will be 1/3 of the width of the band.
The other option would be to use a CreationFilter to change the rect's of the UIElements that make up the summary.
Thank you very much Mike, this got me exactly what I needed.
Now a follow up (there is always a follow up, ugh), what is the code to remove a summary on a Windows Grid. Here is the code I am using to add the summaries...
objSummary2 = grdEmployeeInfo.DisplayLayout.Bands(0).Summaries.Add("EmployeeSummary", SummaryPosition.Left, .DisplayLayout.Bands(0).Columns(1))
I would think it would be
.DisplayLayout.Bands(0).Summaries.Remove("EmployeeSummary")
But this is giving me an error.
Thank you for your help, and let me know if I am on the right path or not.
Thank you Mike. That got what I was looking for.
Does that line of code even compile? When I try to use the Remove method, the Intellisense shows that the methods takes a SummarySettings object, not a string. So you'd have to do something like this:
this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Remove(this.ultraGrid1.DisplayLayout.Bands[0].Summaries["EmployeeSummary"]);
Actually, that seems a bit odd. There probably should be an overload that takes a string.