I'm trying to understand the basic MVVM design approach when using ItemsControl by binding it via DataTemplates to ObservableCollections on the ViewModel.
I've seen examples that bind to ObservableCollections of strings, Views, and ViewModels.
Binding to strings seems to be only for demos, it is the binding to "ViewModels that contain collections of Views that contain collections of ViewModels" that the power of WPF seems to really come out.
For those of use proficient in the MVVM pattern, what is your standard approach to binding ItemsControl, ListView, ListBox to collections in a ViewModel? I'm looking for advice from experience like this:
- always use ObservableCollection<...> and never List<...> because...
- something better than ItemsControl to display a collection is...
- in order to get filtering to work in your ViewModel instead of code-behind, use...
- use collections of Views when ... and collections of ViewModels when...
- 90% of the time I create an ItemsControl and bind it to an ObservableCollection of Views which have their own ViewModels...