I have a Grid whose Rows should be selected via RowHeader. So i’ve set
grid.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
and
grid.RowHeaderMouseClick += GridOnRowHeaderMouseClick;
now i can’t get programmatically Row/Rowheader selection working.
grid.ClearSelection();
grid.CurrentCell = null;
foreach (var row in grid.Rows)
{
if (someCondition)
{
row.Selected = true; // Doesn't mark the RowHeader as selected
row.HeaderCell.Selected = true; // Not supported
break;
}
}
Additionally selecting via a bound Object would be a nice Enhancement.
Best Regards
Corvin
As of now and most likely for the first release the DGV control only supports full row selection. Column and cell selection will be added after the release.
Seems like when I do grid.CurrentCell = null
before selecting, the Row ( and RowHeader) is at all not selected in the UI.
when I comment grid.CurrentCell = null
the RowHeader of the last selected Row is still marked after selecting and the newly selected Row is selected but the RowHeader not.
At both tries in Debug i can see that the selected-Property is changing.
Best Regards
Corvin