Home Forums WinForms controls Xceed Grid for WinForms SelectionBackColor on currentCell? Reply To: SelectionBackColor on currentCell?

Xceed Support
Member
Post count: 5658

Hello,

The grid does not have a property that will allow you to change the selection backcolor of the current cell however what you could do is subscribe to the grid’s CurrentCellChanged event and change the backcolor of the current cell from there. For example:

// In the form’s load event (or any other appropriate location)
gridControl1.CurrentCellChanged += new EventHandler( this.CellChanged );
gridControl1.CurrentCell.BackColor = Color.Pink;
m_previousCurrentCell = gridControl1.CurrentCell;

//In the CurrentCellChanged event handler
private Xceed.Grid.Cell m_previousCurrentCell = null;

private void CellChanged( object sender, EventArgs e )
{
m_previousCurrentCell.ResetBackColor();
gridControl1.CurrentCell.BackColor = Color.Pink;
m_previousCurrentCell = gridControl1.CurrentCell;
}

I hope this helps!

Imported from legacy forums. Posted by Jenny [Xceed] (had 525 views)