Showing a view in a region vs a modal dialog

Topics: Prism v2 - Silverlight 2, Prism v2 - WPF 3.5
Feb 23, 2009 at 9:02 AM
Hi guys

I'm pretty new to this stuff right now and was wondering if you had any guidance or comments on the following simple scenario:

I have a list of customers displayed in my MainContent region. I want the user to be able to edit or add a new customer. So in the edit (or add) command I create a Presenter and View for the edit operation, then add it to a Region obtained from the region manager.

Now, if I wanted to present this edit customer view in a Modal dialog would I basically need to code my own IRegion to that is would use a new window rather than a Content control in the Shells main window? That way I guess, if at some point in the future I wanted to present the editable view in a Panel on the main window that obscures the list of customers I could just change the implementation of the Region.

Does this sound as though I'm on the right track?

Of course, one slight complication is that displaying a modal dialog usually turns editing  in to a synchronous operation. how would IRegion.Add() and IRegion.Activate() do this?

Hmm, I'm struggling a bit here!!
Mar 5, 2009 at 1:57 PM
Edited Mar 5, 2009 at 1:59 PM

Hi

 

The Prism-v2 Desktop Reference Implementation shows an example on how to show a view in a different window by showing the NewsReaderWindow. To see how this works you can debug the ArticleView.xaml code behind, starting with the OpenButton_Click handler method. The ArticleView is located News module inside the Article folder.

 

To access the Reference Implementation you must open the folder where Prism-v2 was decompressed and open $DecompressionDirectory$\RI\StockTraderRI_Desktop.sln solution.

 

On the other hand, some time ago, Ignacio Baumann added a sample Window Region Adapter to the Prism Contrib Project that provides a way to show views in separate windows. The sample was for Prism-v1 but with some adjustments you should be able to get it to work for this version if you required it. You can find the source code of the entire contrib project here.

 

For more information about the Window Region Adapter you can check the following articles:

·         WindowRegionAdapter for CompositeWPF (Prism)

·         WindowRegionAdapter at CompositeWPF (Prism) Contrib

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

Oct 8, 2009 at 3:55 PM

The popup dialog window doesn't have a title. How do we set the title for the popup window?

Thanks