If you used WPF right you would use MVVM
, and use
's. A list box can have different types of containers (stackpanel, etc) with the ItemContainerStyle. You fill the ListBox by binding to the ItemsSource property. You can respond to changes in the selected item in the ListBox by binding to the SelectedItem property. When this property changes, you can do whatever is needed in responce. The other thing you need to know is that you will want to use the ObservableCollection to store the lists since this class automatically handles firing the PropertyChanged events. Binding can be done to a more complex paths such as
. Also have to set the DataContextt for the form/usercontorl to the class containing the properties.
If you are using WPF, you really need to learn about the MVVM pattern and how to use this with WPF. Much easier once you understand it. Do a search on the pattern. Here is one link on codeproject: Model-View-ViewModel (MVVM) Explained