I added one column to group by :
ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(
"ColumnA_name", false, true);
In the header of groupBy I see: "ColumnA_name": value
1)I want to show in this header also value of another column B (all rows in this group by are with the same value in column B). Can I do It?
2) I want to change the color of the groupBy header, accordin to value in column B, Can I do it?
anna79 said:1)I want to show in this header also value of another column B (all rows in this group by are with the same value in column B). Can I do It?
You would do this using the InitializeGroupByRow event. The event gives you a reference to the GroupByRow and you can set it's Description, which is the text displayed in the row.
Some useful properties on the GroupByRow that you will need are:
Value: The value of the grouped column cell.
Column: The column being grouped
Rows: The collection of child rows, so you can read the value of the cells in those rows.
anna79 said:2) I want to change the color of the groupBy header, accordin to value in column B, Can I do it?
Just set the Appearance on the row in the same event.
Yes, you can.
Use GridInitializeGroupByRow event. In the event handler you can check the value in the first row with data and set the caption, color etc. of the group by row appropriately.
if (e.Row.Rows.VisibleRowCount > 0) //Can be filtered out { UltraGridRow firstChildRow = e.Row; RowEnumerator enumeratorForChildRows = null; //Necessary because there may be multiple groups. Loop until we reach the leaf level while (firstChildRow.IsGroupByRow) { enumeratorForChildRows = ((UltraGridGroupByRow)firstChildRow).Rows.GetEnumerator(); enumeratorForChildRows.MoveNext(); firstChildRow = enumeratorForChildRows.Current; } if (enumeratorForChildRows != null) { //Find first usable row with data while (firstChildRow.Hidden || !firstChildRow.IsDataRow || firstChildRow.IsFilteredOut) { if (!enumeratorForChildRows.MoveNext()) { //No usable rows with data found (should be pretty uncommon situation) //just return return; } firstChildRow = enumeratorForChildRows.Current; }
}