locked
MVVM Pattern RRS feed

  • Question

  • Hi all,

    The MVVM pattern seems to solve a lot of problems for making a distinction between data and presentation, but it doesn't seem to address the problem of handling multiple 'pages' of views within a single application.  For example, navigation through multiple pages of interface views does not seem to be addressed.  Are there any specific patterns which deal with this kind of behaviour, ie, handling requests to proceed to the next 'page' in an interface?  Is this generally handled via a command binding between the View and ModelView, which is then delegated up to a higher level view container, for example?  It seems that MVVM needs an extra layer on top in order to handle the actual interaction logic itself.

    Also, could this command binding be between the View and a static instance of an interface controller, allowing the ModelView to retain its pure functionality of data representation?

    Just looking for an existing pattern if one exists presently.

    Thanks!

    Monday, March 5, 2012 8:23 PM

Answers

All replies

  • Hi,

    You can add one more layer called Controller, which will decide on which page/view you need to load, solves the navigation problem.

    The main role of this layer will be injecting the view in the Region/frame.

    Thanks,

    Bimal

    Monday, March 5, 2012 9:49 PM
  • Hi

    Refer This Blog.. About MVVM With MEF.

    Very good Expecience...

    http://jounce.codeplex.com/

    Tuesday, March 6, 2012 12:58 AM
  • About MVVM and navigation, we have joined Laurent's a Rob Garfoot approach in this library:

    http://sdnavigation.codeplex.com/

    Basically, you have to inherit or implement an interface in your ViewModelBase and in the pages where you expect using parameters add an already implemented behavior.

     

    Right now this lib is only available for WP7 but I think it can be easily ported to Silverlight (hope to do it soon when I have to some time available).

    Cheers

      Braulio

     

    Tuesday, March 20, 2012 3:45 AM