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

Multiple Selection & MVVM

3 Answers 82 Views
ListPicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cristovao
Top achievements
Rank 1
Cristovao asked on 13 Aug 2012, 02:55 PM
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?

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 15 Aug 2012, 06:48 AM
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.

0
Cristovao
Top achievements
Rank 1
answered on 16 Aug 2012, 11:59 AM
I've opened a Ticket as Here I cannot post the example solution I've created 
0
Deyan
Telerik team
answered on 17 Aug 2012, 06:53 AM
Hi Cristovao,

Your ticket has been handled.

Kind regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ListPicker
Asked by
Cristovao
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Cristovao
Top achievements
Rank 1
Share this question
or