Binding tip, only create observable collection once

I thought I’d share a really silly mistake I’ve just made. I have a list selector that is bound to an observable collection in my view model. However, when I was adding items to the collection they were not showing in the list. The mistake I had made was that upon refreshing the list I was using collection = new collection, this breaks the binding. So ensure you only create your target collection and if you want to refresh it then use collection.Clear().

Doh!

Advertisements
This entry was posted in Windows Phone and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s