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

RowActivated Clearing out SelectedItems

3 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Darryn
Top achievements
Rank 1
Darryn asked on 22 May 2012, 10:22 PM
I have the following code in my RowActivated EventHandler

private void dgv_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
{
            dgv.SelectedItems.Clear();
 
                foreach (var t in collection)
                {
                    dgv.SelectedItems.Add(t);
                }
}

I have SelectionUnit="FullRow" and SelectionMode="Extended" 

The problem is that the rows are highlighted for a second, then only the row I double clicked on remains highlighted. Is there any way to do this?

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 23 May 2012, 12:01 PM
Hello David,

Generally, when working with Extended selection, the items will be selected when using key modifiers Ctrl or Shift. You can test the behavior on our demos. You can try working with Multiple SelectionMode instead. 
However, since selection is executed on clicking on the items, I am not sure that you will not break the functionality and result in an undesired behavior. Could you clarify what is your exact scenario so that I could try assist any further ? 

Regards,
Maya
the Telerik team

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

0
Darryn
Top achievements
Rank 1
answered on 24 May 2012, 02:14 PM
I am trying to have it that when a user double clicks on a row, it will select that row, as well as all the other matching rows (based on my business logic).
0
Nedyalko Nikolov
Telerik team
answered on 28 May 2012, 02:18 PM
Hello,

Unfortunately RadGridView.SelectedItems collection is read only, and you cannot add items to that collection. However you can take a look at this blog post for an idea how you could sync SelectedItems with a view model.

Kind regards,
Nedyalko Nikolov
the Telerik team

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

Tags
GridView
Asked by
Darryn
Top achievements
Rank 1
Answers by
Maya
Telerik team
Darryn
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or