Home Forums WinForms controls Xceed Grid for WinForms SelectionBackColor on currentCell?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #12652 |

    I have set the SelectionBackColor property on my gridControl to “Highligth”.

    But I would like to set the SelectionBackColor on the “currentCell” to something else than white. (the cell that has focus).

    How is this possible?

    Regards
    C#

    Imported from legacy forums. Posted by C# (had 3244 views)

    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)

    User (Old forums)
    Member
    Post count: 23064

    Thanks

    It works great.

    Imported from legacy forums. Posted by C# (had 4448 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.