Product Information
Product: Telerik UI for WinForms
Control: RadGridView
Version: 2025 Q4
Desired Behavior
When multiple rows are selected, I would like to deselect only the clicked row if the user clicks a row that is already selected.
Current Implementation
I implemented the following logic in the CurrentRowChanging event:
void Grid_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e)
{
if (e.CurrentRow != null && e.NewRow != null)
{
if (e.CurrentRow.IsSelected && e.NewRow.IsSelected)
{
e.Cancel = true;
e.NewRow.IsSelected = false;
}
}
}
Behavior Observed
Case 1
Initial state:
Row A, Row B, and Row C are selected.
CurrentRow = Row A.
Action:
Click Row B.
Result:
Row B is deselected.
CurrentRow remains Row A.
The visual state is updated correctly and Row B is no longer highlighted.
This works as expected.
Case 2
Initial state:
Row A, Row B, and Row C are selected.
CurrentRow = Row A.
Action:
Click Row A (the CurrentRow itself).
Result:
Row A is removed from the selection.
The row is no longer contained in SelectedRows.
However, the entire row remains highlighted in blue.
Investigation Results
I confirmed that CurrentRowChanging is not fired when the user clicks the CurrentRow itself, since the current row is not changing.
After clicking the CurrentRow, I checked the following properties:
row.IsSelected == false
rowElement.IsSelected == false
row.IsCurrent == true
rowElement.IsCurrent == true
rowElement.ContainsFocus == true
radGridView1.SelectedRows.Contains(row) == false
Therefore, the row appears to be completely deselected internally.
Additional Tests
I tried forcing UI updates using the following methods, but the visual appearance did not change:
radGridView1.TableElement.Update(GridUINotifyAction.StateChanged);
radGridView1.TableElement.Invalidate();
radGridView1.Refresh();
Question
Although the row is no longer selected:
row.IsSelected == false
radGridView1.SelectedRows.Contains(row) == false
the entire row remains highlighted in blue.
Is this expected behavior caused by the CurrentRow/Focus visual state, or could this be a rendering issue?
Additionally, is there a recommended way to achieve the following behavior?
Keep the CurrentRow unchanged.
Preserve the remaining selected rows.
When the CurrentRow is clicked again, remove its visual selection highlight so that it appears deselected.
Any guidance or recommended approach would be greatly appreciated.
Thank you.
Product: Telerik UI for WinForms
Control: RadGridView
Version: 2025 Q4
Desired Behavior
When multiple rows are selected, I would like to deselect only the clicked row if the user clicks a row that is already selected.
Current Implementation
I implemented the following logic in the CurrentRowChanging event:
void Grid_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e)
{
if (e.CurrentRow != null && e.NewRow != null)
{
if (e.CurrentRow.IsSelected && e.NewRow.IsSelected)
{
e.Cancel = true;
e.NewRow.IsSelected = false;
}
}
}
Behavior Observed
Case 1
Initial state:
Row A, Row B, and Row C are selected.
CurrentRow = Row A.
Action:
Click Row B.
Result:
Row B is deselected.
CurrentRow remains Row A.
The visual state is updated correctly and Row B is no longer highlighted.
This works as expected.
Case 2
Initial state:
Row A, Row B, and Row C are selected.
CurrentRow = Row A.
Action:
Click Row A (the CurrentRow itself).
Result:
Row A is removed from the selection.
The row is no longer contained in SelectedRows.
However, the entire row remains highlighted in blue.
Investigation Results
I confirmed that CurrentRowChanging is not fired when the user clicks the CurrentRow itself, since the current row is not changing.
After clicking the CurrentRow, I checked the following properties:
row.IsSelected == false
rowElement.IsSelected == false
row.IsCurrent == true
rowElement.IsCurrent == true
rowElement.ContainsFocus == true
radGridView1.SelectedRows.Contains(row) == false
Therefore, the row appears to be completely deselected internally.
Additional Tests
I tried forcing UI updates using the following methods, but the visual appearance did not change:
radGridView1.TableElement.Update(GridUINotifyAction.StateChanged);
radGridView1.TableElement.Invalidate();
radGridView1.Refresh();
Question
Although the row is no longer selected:
row.IsSelected == false
radGridView1.SelectedRows.Contains(row) == false
the entire row remains highlighted in blue.
Is this expected behavior caused by the CurrentRow/Focus visual state, or could this be a rendering issue?
Additionally, is there a recommended way to achieve the following behavior?
Keep the CurrentRow unchanged.
Preserve the remaining selected rows.
When the CurrentRow is clicked again, remove its visual selection highlight so that it appears deselected.
Any guidance or recommended approach would be greatly appreciated.
Thank you.