AD
Administrator
Syncfusion Team
February 24, 2003 11:09 PM UTC
Hi Curtis,
try to get the GridBoundRecordState and the position within the nested table.
Example:
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
if (grid != null && e.ColIndex > 1)
{
if (grid.IsShowCurrentRow(e.RowIndex) && !grid.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex))
{
e.Style.BackColor = SystemColors.Highlight;
e.Style.TextColor = SystemColors.HighlightText;
}
else
{
GridBoundRecordState rs = grid.Binder.GetRecordStateAtRowIndex(e.RowIndex);
switch (rs.LevelIndex)
{
case 0:
if ( rs.Position %2 == 0)
e.Style.BackColor = Color.LightBlue;
else
e.Style.BackColor = Color.White;
break;
case 1:
if ( rs.Position % 2== 0)
e.Style.BackColor = Color.DarkBlue;
else
e.Style.BackColor = Color.Yellow;
break;
default:
if ( rs.Position %2 == 0)
e.Style.BackColor = Color.Blue;
else
e.Style.BackColor = Color.Fuchsia;
break;
}
}
}
}
We'll add support for automatic alternate row colors together with many other improvements for hierarchical display in the 2.0 version.
Stefan