AD
Administrator
Syncfusion Team
August 18, 2004 10:46 AM UTC
Hi Clario,
Try code like this instead:
private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
|| style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
Record r = style.TableCellIdentity.DisplayElement.ParentRecord;
int recordIndex = r.ParentTable.Records.IndexOf(r);
GridColumnDescriptor column = style.TableCellIdentity.Column;
if (column.TableDescriptor.Columns.IndexOf(column) == 4)
e.Inner.Style.BackColor = Color.Red;
}
}
Not sure about this one but check out also the GridEngine.AllowCacheStyles property which we added for 2.1. Then you could do the coloring also in QueryCellStyleInfo.
Then option forces GridRecordRow and GridCaptionRow elements to keep a cache with style information for individual cells and reduce the number of QueryCellStyleInfo calls being raised for this cells.
Stefan
CM
Clario Menezes
August 19, 2004 12:47 PM UTC
Thanks a lot, Stefan! The code you sent worked very well.
- Clario