views:

74

answers:

2

Context: I'm developing a WPF application which will contain a lot of different "screens". Each screen contains a which on its turn contains all the visual elements. Some elements trigger events (e.g., checkboxes), a screen has individual resources, etc.

The main application is "wrapper" around these screens: it contains a menubar, toolbar, statusbar and alike (in a DockPanel) and space to display one screen. Through the menubar, the user can choose which screen he wants to display.

Goal: I want to dynamically load & display & (event)handle one screen in the space in the main application. I don't want to copy & paste all the "wrapper" stuff in all the different screens. And As I have many complex screens (around 300 - luckily auto-generated), I don't want to load all of them at the start of the application, but only upon request.

Question:

What do you recommend as the best way to realize this?
What kind of things should I use and investigate: Pages or windows or User Control for the screens? Does this affect the event handling?

A: 

You can use a Frame to contain the variuos Pages.

Maurizio Reginelli
A: 

Robbie, you can borrow the workspace concept from Josh Smith's WPF MVVM article. What you would do is have one hosting window (your wrapper) and load a workspace into this window. You can close the workspace and load a new one as needed, keeping only one open in your main window.

Link: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

Ed Gonzalez