Navigation, Windows, and Window events.

Oct 12, 2009 at 5:00 PM
Edited Oct 12, 2009 at 5:01 PM

One issue that I have had with pretty much every Mvvm framework that I've ever tried is that there is no support for dealing with windows. 

I know all us LOB devs out there are supposed to be implementing tab mdi interfaces, but lets face it there are still plenty of times when we just need to pop a child window to perform some edit.  A better example is probably just a simple log on form to shell navigation scenario.  The way I want to code this, I would just call something akin to "View.Close()" after the user logs on successfully, but not every view can be "closed" right?  So how should that work?  Getting back to my original example of a child window, something that's pretty common is to show a message box if the user clicks the form close button and they have unsaved changes a la MS office.  Basically, I need to handle the Window.Closing and Window.Closed events, but again not every view is a window so how should that be set up? 

I realize Onyx in its current state, which is still evolving isn't dealing with this yet, but I'm curious if anyone else who is already using it to some degree has come up on the same issues and has some ideas on how to address them.  command binding maybe like in cinch? 

I can tell you I've implemented a IWindowLifetime service and added an OnClosing and OnClosed virtaul method to my viewmodelbase which only gets wired up if the view is a window.  I also put the Close in that interface but while it works, I'm still on the fence about whether or not its the right approach.

Any ideas are both welcome and much appreciated.