开发者

ObservableCollection tutorial? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_StackOverflow Closed 10 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜