MVVM ->

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Aug 18, 2010 at 11:42 AM

Hi guys,

Great to see V4 of prism coming to life! I'll be watching it closely ;) I like the looks of the new samples! Also, the mvvm sample is shaping up to be very interesting.

One thing I'd like to suggest:

I see you have taken the approach of letting a viewmodel select the next view, with syntax like this:

this.uiService.ShowView(ViewNames.CompleteQuestionnaire, questionnaireTemplate);

Have you also considered an approach like this:

this.uiService.ShowViewModel(new QuestionnaireViewModel{Template = questionnaireTemplate});

Then the uiService should find out what view (or skin or datatemplate) to use to visualize that view. The nice thing of this approach is that you can create a complete working tree of your viewmodels in your unit tests, without having to have a live view instantiated. It's also a much more direct way for viewmodels to communicate with eachother, without resorting to a 'context' object. If you need a form of decoupling between different viewmodels, you can hide them behind an interface and either get them from a container or from a service.

If you want, I can provide some more info on why I like this approach.

Anyway, keep up the good work!

with kind regards,

Erwin van der Valk

 

 

Aug 18, 2010 at 8:20 PM

Erwin, thanks for the feedback. 

As always, this is a work in progress and evolving.  I've passed your feedback on to the rest of the team.