Search code examples
c#winformsgridviewdevexpresshighlighting

XtraGrid whole row is highlighted except the clicked cell


When I select a row in the following GridView, the cell that my mouse is resting on (in other words the cell that I left click on) to select a row, is not highlighted while the rest of the row's cells are all highlighted.

I would appreciate your help.

GridView myView = (GridView)oGrid.MainView;
myView.OptionsSelection.MultiSelect = true;
myView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect;

if (myView.RowCount > 0)
{
    frmChangeMyStatus ff = new frmChangeMyStatus(ccfrms);
    DialogResult dr = ff.ShowDialog();

    if (dr == DialogResult.OK)
    {
        for (int i = 0; i < myView.SelectedRowsCount; i++)
        {
            row = myView.GetSelectedRows()[i];
               //...........
        }
    }
}

Solution

  • If you want the focused cell to look like any other cell in the focused row, disable focused cell styling in view properties. You can do this in two different ways:

    • At runtime:

      myView.OptionsSelection.EnableAppearanceFocusedCell = false;

    • At design-time: Invoke XtraGrid designer, select Views :: (your view) :: OptionsSelection :: Set EnableAppearanceFocusedCell to False.

    If you have access to XtraGrid designer, you can check out the Appearance section if you need more complicated styling rules.