Home Forums WinForms controls Xceed Grid for WinForms Coloring row when checkbox is selected Reply To: Coloring row when checkbox is selected

User (Old forums)
Member
Post count: 23064

Have you tried CellValueChanged event of a row. If you’re hooking into events then you’d have to add a handler to each row in your grid and then the data row would be the sender, but that’s not very efficient and easy to work with. A better way would be to inherit from the Xceed.Grid.DataRow class and create your own row. In that way when a cell value changes you can change the colour of the current row with minimal code and effort.

protected override void OnCellValueChanged(System.EventArgs e)
{
if(System.Convert.ToBoolean(Cells[0].Value))
{
BackColor = System.Drawing.Color.White;
}
else
{
BackColor = System.Drawing.Color.Red;
}
}

It’s an idea anyway.

Imported from legacy forums. Posted by Chris (had 273 views)