Windows-8.1

ObservableCollection in C#

MSDN describes ObservableCollection as

Represents a dynamic collection of data that provides notifications when items get added, removed or when the whole list is refreshed

This tip is dedicated to experienced WP developer who had to suffer a lot earlier for INotifyPropertyChanged.

An ObservableCollection can be updated from UI exactly like any collection. The true difference is rather straightforward:

ObservableCollection implements INotifyCollectionChanged which provides notification when the collection is changed. It allows the binding engine to update the UI when the ObservableCollection is updated.

Windows Phone developers who are relatively new, it is suggested to use ObservableCollection instead of List. It has the capabilities of a List in addition to extended capabilities.

Those who developed in WP 8.0 or before, will be glad to know that ObservableCollection will remove a huge pain when you’re going to implement any DataBinding. Earlier we had to use INotifyPropertyChanged interface to make the binding interactive and efficient. And truly that was a pain in the. This modern List like ObservableCollection takes care of all the things. According to Visual Studio Documentation.

Here an example of How to Create and Bind to an ObservableCollection.

This article gives a basic understanding of List, ObservableCollection, and INotifyPropertyChanged.

Faysal

I'm an Undergraduate Student in North South University,Bangladesh studying Computer Science and Engineering. Work as a part time freelancer. I like to discuss about innovative ideas. To me,the most fascinating things about developing an app/product is working as a team continuously for hours and discussing to improve the efficiency of that program. I also enjoy teaching programming over Skype which gives me the feel of expressing myself.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding
Close