Hi,
I need to apply formatting to my groupby header rows depending on the level of the group by level of that row. For example, I am grouping by 3 columns, say A, B, and C. If they Group by row refers to column A, I need to change the row's backcolor to red, if its B, I need to change the row back color to blue.
I'm looping through the rows UltraWinGrid.RowsCollection on my grid, and if the row is a group by row (check the IsGroupByRow property) I cast it to a Infragistics.Win.UltraWinGrid.UltraGridGroupByRow. I can then see a non-public variable called: GroupByRowLevel in my watch window which gives me the index of the groupby row. In my example above, if the group by row was A, this variable would be set to zero. If row was on column B, it would be set to 1, etc.
However, this variable is not exposed (as far as I can find) in the UltraGridGroupByRow object. If I try to call it directly my project fails to compile saying that the variable is protected.
Is there anyway I can access the level of the group by row I am on ?
Thanks,
- Jagat
Hi Jagat,
The GroupByLevel is internal and it's not exposed publicly as far as I can see. But it's easy enough to calculate it yourself.
All you have to do is walk up the Parent chain of the GroupByRow until you come to either null or a row that is not a GroupByRow.
Hi Mike,
That works perfectly! Thanks. Also found I could loop through the rows collection and if the row was a groupby row I loop through the child bands checking for group by rows as well - which works well when you know how many levels you will have (your solution I think is better though - since the number of levels doesn't need to be known)
ie:
RowsCollection rc0 = gridLayout.Rows; foreach (UltraGridRow r0 in rc0) { if (r0.IsGroupByRow) { // Apply my color settings r0.Appearance.BackColor = _crGroupByBackColorL0;
// Check child bands for group by rows ChildBandsCollection cB1 = r0.ChildBands; foreach (UltraGridRow r1 in cB1[0].Rows) { if (r1.IsGroupByRow) {
r1.Appearance.BackColor = _crGroupByBackColorL1;
........
}
Thanks again!