ObservableCollection tutorial? [closed]
Will anyone direct me to some simple, graphical tutorial on how to use ObservableCollection. I went through msdn but I don't seem to understand them. I can't seem to find better ones on google either. I'm looking for simple example with full explanation on all steps.
I don't know of any graphical tutorial of ObservableCollection
. The ObservableCollection<T>
class is a collection type (like List<T>
) which means that it holds objects of a given type T
. What makes ObservableCollection
special is that it "tells" observers when a new object is added or when an object is removed. This is especially useful for UI's implemented using WPF, because esentially, when an object is added to or removed from an observable collection, the UI is automatically updated. This happens because, when binding to an observable collection, WPF automatically adds an event handler to the ObservableCollecion
's CollectionChanged
event.
If you know how to use a List , use a List and after that just replace the world 'List' with 'ObservableCollection'.
That's all !! isn't it simple ? :)
And now, every time the collection is changed (item been added\ removed\ replaced) Your bounded UI will be notified about it.
This is a nice introductory article: http://www.codeproject.com/KB/silverlight/SLListVsOCollections.aspx
How about this tutorial: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-the-listview-part-1
Follow the link on this page for part 2 and 3
精彩评论