Hi All,
Does anyone know if it's possible to change the appearance of a summary row in an UltraGrid for a specific group? In the image below (sorry it may not be too easy to see), if the user selects a GroupBy row I'd like them to be able to change the appearance for that group level.
The areas outlined in red are those that I am unsure how to change:
I have found the properties for ammending the default appearance for summaries, but I'm hoping this is possible too...
Any help will be greatly appreciated.
Cheers,
Richard
Hi Richard,
Richard said:Summary values on each GroupBy row.
This is pretty easy. What I would do is handle the grid's InitializeGroupByRow event. You can examine the GroupByRow and determine what you want to do and then set the appearance of the SummaryValue on that row.
For example:
private void ultraGrid1_InitializeGroupByRow(object sender, InitializeGroupByRowEventArgs e) { if ((int)e.Row.Value == 1) e.Row.Rows.SummaryValues[0].Appearance.BackColor = Color.Blue; }
Richard said: Summary footer row (and it's Summary values).
I don't think there is any simple way to do this. The SummaryValue has an object in the grid that represents it, so there's an appearance for each individual summary value. But there is no such object for the Summary footer row, it's the same for the entire grid. The only way to color this area for just a single row would be to use a DrawFilter.
Also, the Summary footer area you highlight here is comprised of multiple UIElements, so you can't do this by filtering on a single UIElement.
The DrawFilter code is actually not too bad, though. Here's some quick code I whipped up:
public class SummaryFooterDrawFilter : IUIElementDrawFilter { #region IUIElementDrawFilter Members bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { RowsCollection rows = drawParams.Element.GetContext(typeof(RowsCollection)) as RowsCollection; if (rows != null) { UltraGridGroupByRow groupbyRow = rows.ParentRow as UltraGridGroupByRow; if (groupbyRow != null && (int)groupbyRow.Value == 1) { drawParams.AppearanceData.BackColor = Color.Red; } } return false; } DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (drawParams.Element is SummaryFooterUIElement || drawParams.Element is SummaryFooterCaptionUIElement) { return DrawPhase.BeforeDrawBackColor; } return DrawPhase.None; } #endregion }
Thanks Mike!! The code was very helpful! I've implemented a similar DrawFilter that simply applies the appearance properties of the group-by row it's associated with, and then apply that filter to the UltraGrid.
Cheers!
Thanks again Mike. Yes that's as far as I have. Changing the "ContainingTable" property appears to have no affect and changing the ReportGridSummaryRow property results in the following:
I see it regards the Summary Rows as the parts of the grid where summary values are placed. What I need now is for it too style the summary footer the same, and also apply the same font, font colour, bold and italic properties. I couldn't see any properties to do this...only the background colour?
Richard said:Changing the "ContainingTable" property appears to have no affect
Do you mean that setting the Background property on the ContainingTable has no effect?
If that's the case, then it looks like there is no way to change the appearance of the summary footer, which I would consider to be a bug that needs to be corrected.
Yes, would that be a bug on my part? Or Infragistics?
Is it possible to change the font colour, bold and italic also? As I haven't found out how to do that even for the row...
I meant that this is probably a bug in the WinGridDocumentExporter, since it seems to be lacking some pretty basic functionality. Probably just an oversight that needs to be corrected.
I'm going to forward this thread over to Infragistics Developer Support and ask them to write this up for developer review and hopefully we can get this fixed in a future version.
Okidoki, thanks Mike! I'll keep my eye out for the fix.
Thanks, Charlie!
Hello Richard.
The latest service release has a fix for this issue. You can download it at www.infragistics.com in the My Keys and Downloads section. Please let me know if you have any questions about downloading or installing it.
Charlie
Great, thanks!
I have logged this behaviour with our developers in our tracking system, with an issue ID of 34072.
This development issue will be assigned to a developer to research for a fix, workaround, or other resolution. If some other resolution is reached, I will contact you with this information. I hope this helps. Please let me know if you need further assistance on this issue.