SelectionMode=Multiple, SelectedItem and MVVM

9 posts, 0 answers
  1. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 09 Sep 2010 Link to this post

    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>
  2. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 09 Sep 2010 Link to this post

    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?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 10 Sep 2010 Link to this post

    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
  5. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 13 Sep 2010 Link to this post

    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.
  6. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 14 Sep 2010 Link to this post

    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
  7. Richa
    Richa avatar
    11 posts
    Member since:
    Sep 2010

    Posted 03 Mar 2011 Link to this post

    I also need such type of functionality, Please answer.
  8. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 03 Mar 2011 Link to this post

    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!
  9. Vinod
    Vinod avatar
    5 posts
    Member since:
    Nov 2011

    Posted 03 Jan 2012 Link to this post

    please tell me how can we retrieve muliple selected rows in our View Model...How can we do this?? any running project??
  10. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 03 Jan 2012 Link to this post

    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 >>

Back to Top
UI for WPF is Visual Studio 2017 Ready