Changing the View of the Main Window

Topics: UI Architecture
Jun 15, 2012 at 5:14 PM


Is it possible to change the main window's view without having to re-create the window? Our situation is this: we have a tablet like device that is running Windows embedded and our application we need to able to respond to the orientation of the device changing from landscape to portrait. 

I was hoping that I'd be able to convince the ViewModel for the main windows to re-load its view, and all its sub-views; however, all my current experiments seem to indicate that the main window will need to be re-created. Is this the case, or, can I get the view-model to re-load its view on the fly?



Jun 15, 2012 at 5:32 PM

Is your Shell view model a Window? If so, you need to re-create it. Otherwise (i.e. the Shell view is a UserControl, wrapped inside a Window by CM), there could be a way to change the the current view, forcing a re-evaluation of the view-model -> view location. Never tried, tho.