Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get MVVM Light to work nicely with a Grouped Items Page in Metro?

I am trying to implement a Metro style Grouped Items Page using the MVVM Light framework following the sample in this blog post but using a ViewModelLocator to provide blendability:

http://mikaelkoskinen.net/post/winrt-tutorial-mvvm-gridview-semanticzoom.aspx

I have got this working, unfortunately the grid itself is not showing up in the designer (which is the point of me using MVVM Light). I have bound the title without problem so I know that the viewmodel is bound correctly.

Any ideas please?

like image 562
Dan Ryan Avatar asked May 04 '12 11:05

Dan Ryan


1 Answers

I had the same problem. The issue is, if you're using a CollectionViewSource, that it needs to be explicitly, like this:

As MVVM Light injects design-time-services into the viewmodel you'd expect this to pick up your service and push the design-time data through your viewmodel to the UI. But it doesn't.

You need to give it an explicit design-time instance for this to work:

There is a useful article about using CollectionViewSource in design mode that may help.

like image 87
Faster Solutions Avatar answered Oct 24 '22 22:10

Faster Solutions