UI composition (through composition of ViewModels)

Feb 27, 2013 at 7:36 PM
You mention that you can do UI Composition through composition of ViewModel, and if I'm not mistaken you are showing it in the Kona Adventure Work App CheckoutHubPage.xaml , but what if I didn't want to hard code the Usercontrol list in there, what if I had a list of UserControlViewModel in the CheckoutHubPageViewModel and with that List I would like to render the UserControl that is linked to that ViewModel.

I've seen this working in Caliburn.Micro in Silverlight, can we do something similar here with WinRT?

Let me know if this is not clear enough,
Mar 1, 2013 at 6:31 PM
Hi Gene,

We are doing something similar to the scenario you proposed, but using DataTemplates instead of UserControls. Basically, we set a collection of ViewModels in a ListView's ItemsSource, that contains a specific DataTemplate. Then, we use data binding inside the DataTemplate.

You can find this functionality implemented in the ShoppingCartPageViewModel and the CheckoutSummaryPageViewModel.

Hope this helps,
Mar 4, 2013 at 2:29 AM
Thanks Mariano, I'll take a closer look