GGC: Row Highlight

Hi,

I want to be able to highlight a row with the exception of one column. This column will have a color associated with it based on some parameter, so I do not want the color to be override by the highlighting when I select that row. In other words, I want the entire row to be highlighted, for example in yellow, but this column remain its original color, for example blue.

Thanks in advanced!

1 Reply

GR Golda Rebecal Syncfusion Team September 24, 2007 11:33 AM UTC

Hi Patrick,

You can highlight a row except one column by checking the appropriate column index and applying style in the PrepareViewStyleInfo event.

void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridControlBase grid = this.gridGroupingControl1.TableControl;
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

// Highlight the current row with yellow color and bold font
if (e.RowIndex > grid.Model.Rows.HeaderCount && e.ColIndex > grid.Model.Cols.HeaderCount
&& cc.HasCurrentCellAt(e.RowIndex) && e.ColIndex != 3)
{
e.Style.Interior = new BrushInfo(Color.Yellow);
e.Style.TextColor = SystemColors.HighlightText;
e.Style.Font.Bold = true;
}
else if (e.ColIndex == 3)
e.Style.Interior = new BrushInfo(Color.Blue);
}

Please refer to the attached sample that illustrates the same:
http://websamples.syncfusion.com/samples/Grid.Windows/F68434/main.htm

Kindly let me know if this helps you.

We appreciate your interest in Syncfusion products.

Best regards,
Golda

Loader.
Up arrow icon