In one of my Wingrids I have to reset the group's description and display it in a different format. Below I have attached a sample that will show the same issue.
To view the issue, please open the sample application.
1) Click the load button.2) Group by Column #2 (Super Hero). After grouping, the "InitializeGroupByRow" method changes the description (display text for the group) little differently. You can notice one of the rows shows three as count. 3) Click refresh button again. Now you can notice the counts getting reset into "1".
Hi Oscar,
I'm not sure exactly why the description is changing, but the code you have here will not work correctly in any case. You are setting the description based on values within the description. This is not a good idea at all, because this event could fire again for the same row and you would end up recursively building a string based on itself.
For what you are trying to do here, it seems like you should be using the GroupByRowDescriptionMask property, rather than the InitializeGroupByRow event.
private void ugDataGrid_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.GroupByRowDescriptionMask = "[caption] ([count] [count,items,item,items]) - [value]"; }
Only catch I a facing is I need to control the size fo the value being placed in the group's description. Is there any way to control that?
What do you mean by the size? You want to limit the text to a certain number of characters?
If you want to do that, then you will have to go back to using the InitializeGroupByRow event. But I would not use values from within the string to build the string. You can determine the number of child rows using e.Row.Rows.Count, instead.