XtraGrid whole row is highlighted except the clicked cell
Asked Answered
S

2

5

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];
               //...........
        }
    }
}
Sohn answered 2/5, 2012 at 19:24 Comment(2)
Is this a DevExpress XtraGrid?Wide
@Yuris Guts : I think so. Any ideas would be highly appreciated.Sohn
W
10

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.

Wide answered 2/5, 2012 at 20:21 Comment(0)
S
1

In addition to what Yuriy Guts said above about the focus cell appearance for the view, if the cell that is selected is editable, it will still not highlight that cell.

So, if the cell doesn't need to be editable, you can set OptionsColumn.AllowEdit = false for that column. Otherwise, if the user selects a row by clicking on a cell, you have to live with that appearance so that the user can tell which cell they are currently editing.

Sutherland answered 3/5, 2012 at 12:15 Comment(3)
Thank you but I can not find OptionsColumn.AllowEdit in DevXpress's GridView.Sohn
Its a property of the column, not the view directly.Sutherland
Thanks again, my problem was solved by using Yuriy's suggestion, and I did not have to set AllowEdit to false, maybe because at design tme it is set to false by default. But I highly appreciate your following up with my questipon and I did find the AllowEdit property. Thanks again.Sohn

© 2022 - 2024 — McMap. All rights reserved.