The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Programming ListBox Control in XAML and WPF
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
vincent pielPosted Jan 27, 2011, 12:41 PM
Interesting article, yet the DataBinding with an Object is not in the wpf "spirit" : The Arraylist used is a type that cannot notify of its change, that is why you need to force Binding with the ApplyBinding() function. The rigth way to do the data binding is to use a data structure that can notify, like an ObservableCollection of WhateverType, and this will raise InotifyCollectionChanged when update is made, and so no explicit binding has to be done. Just don't forget to set the right binding mode (should not be a "OneTime") (for InotifyCollectionChanged import System.Collections.ObjectModel ) You can also implement an INotifyCollectionChanged Interface yourself. (imports System.Collections.Specialized) You may also want to add an INotifyPropertyChanged Interface to the objects (System.ComponentModel) Notice that to truly respect the MVVM paradigm, one must expose the add/remove as commands into the xaml. But for a simple list, that would be killing a fly with a shotgun. B.R., Vincent Piel