On Wed, Nov 3, 2010 at 7:02 PM, Winston Pang <winstonp...@gmail.com> wrote: > Hey guys, > > I'm trying to apply MVVM in the WPF navigation model. > > I was just doing some thoughts around it > > Apart from the rule that the view model shouldn't know about the view, how > would a particular view spawn another view, and push it to the navigation > service for example? I've been playing around with some ideas of holding a > mapping between the View and ViewModel in a global list in App. Then have > App register against the messenger/mediator to respond to any other view > model's wanting to spawn a new view and navigating it to it. I'm not sure if > I'm on the right track. > > Would love to see how some other people have done it on here?
A colleague of mine (much smarter than me) implemented a generic workflow system that was when used by several "views" (Silverlight/Mobile/Web/WPF). Basically, there was just a core workflow API, with was then held by each of the areas, and they would then implement/subclass appropriate items to render the various items (next/previous buttons, rendering of content in the certain type of question/input/whatever). I think this fits into your requirements. But I know I haven't given a lot of real detail. I can't quite remember exactly how it was implemented, and I don't work there anymore, but contact me offlist perhaps and I can tell you what I remember. The point is, a global mapping sounds bad. I think a strict sort of composition-based approach seems nice, with views being based of the core workflow system and rendered in some dynamic fashion. Hope this is reasonably useful. > Thanks. > > --Winston -- silky http://dnoondt.wordpress.com/ "Every morning when I wake up, I experience an exquisite joy — the joy of being this signature."