Multiple CollectionViewSource on a single user control

Multiple CollectionViewSource on a single user control

Old forum URL:

TerryH posted on Sunday, September 12, 2010

I'm trying to use multiple collection view sources in a single user control, following Rocky's MVVM pattern.

The only collectionviewsource that gets loaded is the one passed as a parameter to

Shell.Instance.ShowView( viewName, bindingResourceKey, model, region)



How can I get the other collectionViewSources to load ?

RockfordLhotka replied on Monday, September 13, 2010

I build my views with the assumption that there's one "root" viewmodel that is bound to the "root" CVS.

If you follow this approach, then your root viewmodel will have properties that expose any other models or viewmodels required by the view. When you drag those properties onto the designer from the Data Sources window the designer will automatically create any "child" CVS objects necessary to get at those objects - and you'll see that they all bind back to that one root CVS which is bound to the root viewmodel.

The only place this gets complex is with async server requests. In that case it is possible to get your various objects (the business object, the name/value list for your combobox, etc) back at different times, in different orders, and that can make the UI seem unreliable.

To overcome that, use a unit of work pattern as described in the Core 3.8 video series and mentioned here:


Copyright (c) Marimer LLC