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

SelectionMode=Multiple, SelectedItem and MVVM

8 Answers 879 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Roy Halvorsen
Top achievements
Rank 1
Roy Halvorsen asked on 09 Sep 2010, 12:56 PM
I have a RadGrid where the user is supposed to select more than one item (multiple). In the ViewModel I have a property called _SelectedItem with NotifyPropertyChanged. First time i click a row in the grid, I get into the _SelectedItem property setter, but if I also want to select another row, the setter of _SelectedItem property is not fired. Am I missing something? CodeBehind is not allowed in the project where this is to be used.

This is my Grid:
<telerik:RadGridView Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="4"
                      ItemsSource="{Binding ModelCollection}"
                      ActionOnLostFocus="None"
                      AutoGenerateColumns="False"
                      CanUserSortColumns="True"
                      IsFilteringAllowed="True"
                      SelectionMode="Multiple"
                      ShowGroupPanel="True"
                      RowIndicatorVisibility="Collapsed"
                      Height="470"
                      CanUserSelect="True"
                      SelectedItem="{Binding SelectedModel, Mode=TwoWay}"
                      IsSynchronizedWithCurrentItem="False"
                      IsReadOnly="True">
     <telerik:RadGridView.Columns>
         <telerik:GridViewDataColumn Header="Kode" Width="100" DataMemberBinding="{Binding Code}" />
         <telerik:GridViewDataColumn Header="Tekst" Width="360" DataMemberBinding="{Binding Text}" />
     </telerik:RadGridView.Columns>
 </telerik:RadGridView>

8 Answers, 1 is accepted

Sort by
0
Roy Halvorsen
Top achievements
Rank 1
answered on 09 Sep 2010, 01:32 PM
After some testing, I changed the SelectionMode to "Extended", and it works now and then if I use the ctrl+click or shift+click. If I select 4 items, the count is sometimes 4, sometimes 2, sometimes 3... Is this a bug in version 2010.2.812.40? And how can I achieve my goal without keyboard interaction?
0
Milan
Telerik team
answered on 10 Sep 2010, 12:00 PM
Hi Roy Halvorsen,

If you would like to select multiple items without keyboard interaction you should set SelectionMode to Multiple. 

I am curious to understand which is the count that you are referring to? Is that the count of the SelectedItems property?

Regards,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roy Halvorsen
Top achievements
Rank 1
answered on 13 Sep 2010, 07:39 AM
Yes it is. Most of the times when I loop through the selected items, it does not show all of my selected items. I have solved my selection issue by writing a behavior and SelectionMode set to Multiple, and it works the way I want it to, but that does not solve the Extended issue.
0
Milan
Telerik team
answered on 14 Sep 2010, 01:10 PM
Hello Roy Halvorsen,

That is very strange. We would really appreciate it if you could send us a sample project that demonstrates this issue.


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richa
Top achievements
Rank 1
answered on 03 Mar 2011, 01:54 PM
I also need such type of functionality, Please answer.
0
Rossen Hristov
Telerik team
answered on 03 Mar 2011, 02:34 PM
Hi Richa,

Since we cannot reproduce the behavior described in this thread, we would really appreciate it if you could send us a sample project that demonstrates this issue.

Thanks in advance.

All the best,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Vinod
Top achievements
Rank 1
answered on 03 Jan 2012, 12:26 PM
please tell me how can we retrieve muliple selected rows in our View Model...How can we do this?? any running project??
0
Vlad
Telerik team
answered on 03 Jan 2012, 12:28 PM
Hi,

 I suggest you to check this blog post for more info. 

Greetings,
Vlad
the Telerik team

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

Tags
GridView
Asked by
Roy Halvorsen
Top achievements
Rank 1
Answers by
Roy Halvorsen
Top achievements
Rank 1
Milan
Telerik team
Richa
Top achievements
Rank 1
Rossen Hristov
Telerik team
Vinod
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or