Saturday, December 4, 2010

Update to How to add items to Windows Phone 7 ListPicker

I had this clarified by Delay

ListPicker? I hardly even know 'er! [A detailed overview of the Windows Phone Toolkit's ListPicker control]

Delay clarified

ObservableCollection (via ItemsSource) is definitely the most flexible option for ItemsControl subclasses like ListPicker. However, your first example using Items.Add should work, as well. You don't say what about that didn't work for you, but one thing to remember with all ItemsControl subclasses is that you can't mix Items and ItemsSource - you need to pick one method of providing the items and then use that exclusively or else an exception results.

My reply

Delay,
I got it working.
You are right.
I was making the mistake of mixing up items and ItemSource.
Both the following  scenarios work:
1. When I have a list and add items to the listpicker using foreach.
2. Bind list directly to listpicker  .
I think I was getting into trouble when I mixed up both.
Thanks.
Vijay

No comments:

Post a Comment