Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing ListPicker and DataBinding
    primarykey
    data
    text
    <p>Ok. I give up. I want to use ListPicker control in one of my Windows Phone apps. I am getting an Exception <strong>SelectedItem must always be set to a valid value</strong>.</p> <p>This is my XAML piece of ListPicker:</p> <pre><code>&lt;toolkit:ListPicker x:Name="CategoryPicker" FullModeItemTemplate="{StaticResource CategoryPickerFullModeItemTemplate}" Margin="12,0,0,0" ItemsSource="{Binding CategoryList}" SelectedItem="{Binding SelectedCategory, Mode=TwoWay}" ExpansionMode="ExpansionAllowed" FullModeHeader="Pick Categories" CacheMode="BitmapCache" Width="420" HorizontalAlignment="Left" /&gt; </code></pre> <p><code>CategoryList</code> is an <code>ObservableCollection&lt;Category&gt;</code> in my ViewModel. <code>SelectedCategory</code> is a property in my ViewModel of type Category.</p> <p>This is how I am declaring both CategoryList and SelectedCategory:</p> <pre><code>private Category _selectedCategory;// = new Category(); private ObservableCollection&lt;Category&gt; _categoryList = new ObservableCollection&lt;Category&gt;(); public ObservableCollection&lt;Category&gt; CategoryList { get { return _categoryList; } set { _categoryList = value; RaisePropertyChanged("CategoryList"); } } public Category SelectedCategory { get { return _selectedCategory; } set { if (_selectedCategory == value) { return; } _selectedCategory = value; RaisePropertyChanged("SelectedCategory"); } } </code></pre> <p>Appreciate your help!!! Maybe I have not understood the usage of ListPicker very well.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload