I am using UltraGrid with GroupBy feature enabled, and I have the following features to allow showing summary cells on the groupby row.
band.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells; band.Override.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows;
I also created some custom SummaryCalculators which everything worked as expected, but I was only able to display text within these summary cells. For example, if a column is a checkbox style column, I would like the summary cell to also be a CheckBox with a summary value that figures out by a custom SummaryCalculator. If it is an image style column, I want to display an summary image on the summary cell of the column as well. Is there a way to do that?
Thanks.
Michael
Hi Michael,
There's no built-in support for CheckBoxes in summary cells. I think it might be possible to display an image in a summary cell via the Appearance, but not as the summary value.
You could probably achieve this using a CreationFilter, but this is not a trivial undertaking. I could probably help you with that, but just to clarify, you don't want the checkbox in the summary to be clickable, do you? Displaying a Checkbox in a summary would be one thing, but making it editable would be something else.
Regarding images, I assume you are actually assigning an Image object to the summary value via your custom summary calculator? Or are you just assigning some numeric or other key value that you expect to translate into an image?
Thanks Mike. Ok, I actually explored a similar approach (perhaps the same) using DrawFilter on the grid, and draw the checkbox as an image by using checkbox.DrawToBitmap(...) to create the image when drawing SummaryValueUIElement. There is no need to for these summary cells to be editable, it's all read-only. I was hoping there are other ways. Just wondering, has anyone else asks for this feature? Thanks.
CreationFilters are pretty tricky - although they are very similar to DrawFilters. The best way to explore then, in my opinion, is to search the forums for "CreationFilter." I've posted tons of examples over the years. Of course, there isn't one to do exactly what you want here, so the examples can show you the basics, but not really the specifics for this case.
You should also get the Infragistics UIElementViewer Utility if you don't already have it.
And I whipped up a really quick, simple sample project here that should point you in the right direction. It shows CheckBoxes in the summary value. For images, you would use an ImageUIElement instead of a CheckBoxUIElement, but the approach is essentially the same. And in my sample, I didn't want to take the time to write a custom summary calculator, so I just based the checked state on whether the total was 0 or not. But in your case, you are presumably using the CustomSummaryCalculator to return a Boolean, so that will be easier for you.
Thanks Mike for your quick response. I did a quick search online on how to use CreationFilter and was not able to find examples. Can you point me to the any examples or documentation on how to use it? Thanks.
A CreationFilter is a little easier than a DrawFilter in this case, since you can just put a CheckBoxUIElement in there, set it's checked property and it will handle the drawing. It will even pick up the appearance of CheckBoxes in the grid, like if you assigned Glyphs or via AppStylist.
I don't recall specifically if anyone has ever asked for this before. I expect it probably has been brought up, but it's not common enough to warrant adding it to the grid when it can be done via the CreationFilter.
But I encourage you to Submit a Feature Request. It couldn't hurt. :)