Programming ListBox Control in XAML and WPF
This tutorial shows you how to create and use a ListBox control in WPF and XAML. The tutorial also covers styling and formatting, add images, checkboxes, and data binding in a ListBox contrtol.
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

vincent pielPosted Jan 27, 2011, 7:41 AM EST
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