Multiple Selection & MVVM

4 posts, 0 answers
  1. Cristovao
    Cristovao avatar
    24 posts
    Member since:
    Jun 2012

    Posted 13 Aug 2012 Link to this post

    I'm trying to binde my ListPicker to an object that contains 2 collection , 1 for the values and one for the selected values


    public ObservableCollection<CategoryFilterValue> SelectedValues
          {
              get { return _selectedValues; }
              set
              {
                  if (value != _selectedValues)
                  {
                      _selectedValues = value;
                      NotifyPropertyChanged("SelectedValues");
                  }
              }
          }
     
     
     private ObservableCollection<CategoryFilterValue> _Values;
          public ObservableCollection<CategoryFilterValue> Values
          {
              get { return _Values; }
              set
              {
                  if (value != _Values)
                  {
                      _Values = value;
                      NotifyPropertyChanged("Values");
                  }
              }
          }

    And XAML

    <telerikInput:RadListPicker
                                              Header="{Binding Text}"
                                              ItemsSource="{Binding Values}"
                                              Width="460" x:Name="radPicker"
                                              SelectionMode="Multiple"
                                              OkButtonIconUri="/Toolkit.Content/appbar.check.rest.png"
                                              CancelButtonIconUri="/Toolkit.Content/appbar.close.rest.png"
                                              SelectedItem="{Binding SelectedValues,ElementName=radPicker,Mode=TwoWay}"
                                              SelectionChanged="radListPicker_SelectionChanged" NoSelectionContent=" "
                                              >
                                              <telerikInput:RadListPicker.ItemTemplate>
                                                  <DataTemplate>
                                                      <StackPanel>
                                                          <TextBlock Text="{Binding Text}" />
                                                      </StackPanel>
                                                  </DataTemplate>
                                              </telerikInput:RadListPicker.ItemTemplate>
     
                                          </telerikInput:RadListPicker>


    But this seams not to work as I do something like   SelectedValues.Clear(); 
    but my listpicker still shows previous selections
    Any thoughs?
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 15 Aug 2012 Link to this post

    Hello Cristovao,

    Thanks for writing.

    You have to make sure that the items in both collections are the same. That means, the items contained in the SelectedValues collection should be the same objects that are provided to the ListPicker via the Values collection.

    If this is the case and the issue persists, please let me know.

    All the best,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Cristovao
    Cristovao avatar
    24 posts
    Member since:
    Jun 2012

    Posted 16 Aug 2012 Link to this post

    I've opened a Ticket as Here I cannot post the example solution I've created 
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 17 Aug 2012 Link to this post

    Hi Cristovao,

    Your ticket has been handled.

    Kind regards,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top