Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need a view controller for MVVM-light in Silverlight?

I have the following question regarding MVVM light: what "drives" the UI? I see I can have a ViewModel per View I am showing; the ViewLocator handles all the ViewModels (for caching as I understand). But what is driving the UI?

If I have a Command defined in my ViewModel that says "ShowDetail"; do I have to write the code for displaying this View inside the ViewModel?

Are there any examples of this? Thanks!

like image 549
Stefan de Vogelaere Avatar asked Apr 19 '10 05:04

Stefan de Vogelaere


2 Answers

The MVVM pattern by itself doesn't have anything specific for navigation between views. Although, there are many solutions for that in several frameworks. The most common solution is to use some sort of controller that "orchestrates" the main View, or to use a "Master-Detail" approach for subviews.

Some interesting solutions:

  • nRoute by Rishi Oberoi (Orktane)
  • Magellan by Paul Stovell
  • Ocean's View Manager by Karl Shifflett
  • "Subview" approach by Josh Smith
like image 199
robertos Avatar answered Sep 29 '22 14:09

robertos


I have created a T4 template that generates code and shows how to navigate to a uri or object, or close a window (wpf). It works with mvvm light

Download here

like image 34
Rick Rat Avatar answered Sep 29 '22 16:09

Rick Rat