What's the best approach for creating MDI popups in WPF?
I need to create a prototype to test WPF's ability to do the following:
- one base window as application base
- in this window the user can click (for example on "add customer") and a new window will appear
- the popup is bright.
- the main window in the background is dimmed
- if the user clicks on the main window
- The main window becomes bright.
- the popup is dimmed and goes into the background.
- any changes in one window, we need to immediately apply in all windows, bright or dark
Questions:
- should child windows be custom controls or windows?
- Is there any "MDI framework" I can use
- Is there anything special that I should consider to make sure all windows are constantly updated, eg. use ObservableCollections etc.?
- Should all global variables be stored as properties in the main window so that child windows can access them?
- How would you share "window dimming" or "window blur" in WPF?
Any advice is appreciated.
0
a source to share
1 answer
- child windows should pop out of the window and then call Show () on an instance of your class to show the modeless dialog.
- Not that I know.
- Use WPF data binding to keep everyone up to date - your data classes should inject INotifyPropertyChanged and expose collections via an ObservableCollection as you stated. The main window and the popup must have the same object for the DataContext, so if one screen changes a property of the object, it will automatically update.
- Use Model View - Model Model to keep data and user interface completely separate. Try this toolkit: http://blogs.msdn.com/ivo_manolov/archive/2009/05/03/9584900.aspx
- There is no real "dim" function, but you can do something like this:
code:
<Window>
<Grid x:Name="dimElement">
<Grid Background="Gray" Opacity="0.5" Visibility="Collapsed"/>
<Grid>
main content goes here
</Grid>
</Grid>
</Window>
If you want to dim the window, set the Visibility on dimElement to "Visible" and set it to "Minimized" to dim if necessary.
Hope it helps!
+1
a source to share