This is a migrated thread and some comments may be shown as answers.

Ctrl-click on the focused cell doesn't unselect the row

2 Answers 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 08 Dec 2011, 03:52 PM
We need to be able to unselect a row in the grid by ctrl-clicking on it. This seems to work if you click anywhere in the row except for selected (focused) cell. Is there a way to make ctrl-click work on the selected cell?

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 09 Dec 2011, 08:39 AM
Hello Boris,

 Could you please confirm the version of the RadControls that you use? Is it the latest (Q3 2011) version?

I have tested this scenario in this online example. First I select a row. Then I hold the 'Ctrl' key and I click on the focused cell, so the selected row is unselected.
Could you please confirm if this is your case?

Best wishes,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Boris
Top achievements
Rank 1
answered on 13 Dec 2011, 04:59 PM
I've also opened a ticket for this issue and wanted to update the thread with the results of that conversation.

We were using 2011.2.920 version of Rad Controls. The issue has been solved in the Q3 2011 version of the controls. We have upgraded to the newest version. I have also got this suggestion for a workaround from Telerik, in case an upgrade wasn't possible.

public MainWindow()
       {...
           this.RadGridView.CanUserSelect = false;
           this.AddHandler(FrameworkElement.MouseDownEvent, new System.Windows.Input.MouseButtonEventHandler(OnMouseDown), true);
       }
    
       private void OnMouseDown(object sender, MouseButtonEventArgs e)
       {
           var s = e.OriginalSource as FrameworkElement;
           var parentRow = s.ParentOfType<GridViewRow>();
           if (parentRow != null)
           {
           if (Keyboard.Modifiers == ModifierKeys.Control)
           {
               parentRow.IsSelected = false;
           }
           else
           {
               parentRow.IsSelected = true;
           }
    }
}

And to keep the keyboard navigation:
private void DataGridViewCurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)
{
       this.RadGridView.SelectedItem = e.NewCell.DataContext;
}
Tags
GridView
Asked by
Boris
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Boris
Top achievements
Rank 1
Share this question
or