[Solved] RadGridView Multiple Selection - CurrentRow Remains Highlighted After Being Deselected

1 Answer 27 Views
GridView
Shiori
Top achievements
Rank 2
Iron
Shiori asked on 29 Jul 2026, 07:27 AM | edited on 31 Jul 2026, 02:15 AM

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 event:CurrentRowChanging

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 is not fired when the user clicks the CurrentRow itself, since the current row is not changing.CurrentRowChanging

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.

---------------------------------------------------

The issue looks like it can be resolved with the following code:

 private void GridView_RowFormatting(object sender, RowFormattingEventArgs e)
 {
     if (e.RowElement.RowInfo.IsSelected)
     {
         e.RowElement.DrawFill = true;   
         e.RowElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;  
         e.RowElement.DrawBorder = true;
         e.RowElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder; 
     }
     else
     {
         e.RowElement.DrawFill = false;
         e.RowElement.DrawBorder = false;
     }
 }

 private void GridView_CellFormatting(object sender, CellFormattingEventArgs e)
 {
     if (e.CellElement.RowInfo.IsSelected)
     {
         e.CellElement.DrawFill = true;
     }
     else
     {
         e.CellElement.DrawFill = false;

     }
 }

However, the ">" indicator for the CurrentRow and the border that remains around the selected cell are still displayed.

Is there a way to remove these as well?

Please refer to the attached image.

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 31 Jul 2026, 07:50 AM

Hi, Shiori,

Thank you for contacting us.

To remove the border over the selected cells, you can use DrawBorder=false in the CellFormatting event:

private void GridView_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.RowInfo.IsSelected)
    {
        e.CellElement.DrawFill = true;
       e.CellElement.DrawBorder = false;
    }
}

If you want to remove the selected row indicator ('>'), you can use this:

this.radGridView1.MasterTemplate.ShowRowHeaderColumn = false;

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Modernizing a WinForms application? Use the AI-powered WinForms Converter to simplify migration to Telerik UI for WinForms.
Tags
GridView
Asked by
Shiori
Top achievements
Rank 2
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or