We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Highlighting active row

I am using the following code to highlight the "current" row in the grid: GridControlBase grid = SelectionGrid; GridCurrentCell cc = SelectionGrid.CurrentCell; if ( e.RowIndex > grid.Model.Rows.HeaderCount && e.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt( e.RowIndex )) { e.Style.Font.Bold = true; e.Style.BackColor = Color.LightSkyBlue; // e.Style.BackColor = Color.FromKnownColor( System.Drawing.KnownColor.Highlight); } I have two issues: 1) I would like to use the System's Highlight color for the back color and Highlight and ForeColor to Highlight Text, but can't figure out how to change the text color and 2) when the user clicks on a cell, that cell's back color is different. How do I get it to look the same as the rest of the row? I guess in general, is there a better way to implement a "row select" looking mode? Jeff

2 Replies

AD Administrator Syncfusion Team November 17, 2003 04:38 PM UTC

To change the text color, use the e.Style.TextColor property. If you do not want the currentcell to be editable, then the simplest way to make sure it is the same color as the rest of the row is to handle the CurrentCellActivating event, and in the handler set e.ColIndex = 0. If you want the cell to be editable and show some same colors as the rest of the row, it is possible, but requires a little more work handling PrepareViewStyleInfo and specifically checking for the current cell.


JB Jeff Block November 18, 2003 08:21 AM UTC

Perfect on both counts! Non-editable is the desired behavior. Thanks. Jeff

Loader.
Up arrow icon