Multiple windows in a shell

Apr 15, 2008 at 11:32 AM
Hi and first of all thanks to Glenn and the Prism team for starting to provide the drops.
I have tried out the reference implementation a little bit and have some questions. In the reference implementation you are using layered user controls. I find that this is very often insufficient. Often there is a requirement to load different windows (dynamically) that needs to be positioned and that have to communicate. So my question is: Will you add more windows (WPF) to the RI? When you got more windows the command and event routing starts to be a pain.
So any solutions about how to add more windows to the shell etc would be very much appreciated.

Apr 15, 2008 at 7:51 PM
There's no support for it as far as I know.

I've been working on my own customized version where I've added a few new abstractions: workbenches and workspaces. A workbench is like a window or form, and can have many workspaces. A workspace is a collection of several regions. Startup > bootstrapper > shell > workbench > workspace > region > (module) view
Apr 15, 2008 at 9:05 PM
i'm working on the same issue, so i'm very interested in this thread.
Would or can you share the code with us????
Apr 17, 2008 at 10:13 AM
In the newest drop of Prism we have added an extensible region mechanism, and we have a notion of local regions.

Region extensibility makes it very easy for you to create your own regions. You simply create a customer region class that implements IRegion<T> where T is the type of UIElement that should use that region.

Local regions allow you to have region managers that are scoped to a specifc view. This allows you to have say an OrderView that contains an OrderHeaderRegion. Each instance of OrderView will have it's own local instance of OrderHeaderRegion it can inject into.

As to the commanding, we've done a ton of work in the last two drops related to using commands to fire actions on a specific instance of a view. You can see this in the RI with our new Buy/Sell screen. We're using a new CompositeCommand and ActiveAwareCompositeCommand. Both commands take a collection of child commands that are invoked whenever the composite command's Execute is called. In the same way, calling CanExecute on the composite, will call CanExecute on the children. The difference between the ActiveAware command, is that in this case we have multiple views each contributing a child command, but only one is active at a time. In the case of the Buy/Sell this is what is used when you press the submit button in the toolbar and only the current order gets submitted.

You can see more about this in our release notes
section, by looking at the past iterations notes.

May 28, 2008 at 11:38 AM
Edited May 29, 2008 at 6:19 AM
Has anyoen had any success with adding multiple instances of a module to the same same Region in the root application. Not matter what I try to tend to get "Region with the given name is already registered" exceptions for the the region that exists within my module. This is driving me nuts, so any help would be greatly appreciated.

Glenn, can you please point me towards some documentation or some example code on how the local regions work?



Jun 1, 2008 at 8:27 PM
Edited Jun 1, 2008 at 10:58 PM

HI Justin

The UI Composition Quickstart illustrates an example of using Local Regions. Additionally we demonstrate local regions in the Stock Trader RI with the Buy/Sell screens.

In the EmployeeDetailsView.xaml in the Quickstart you will see the following

<UserControl x:Class="UIComposition.Modules.Employee.EmployeesDetailsView"
        <TabControl x:Name="DetailsTabControl" prism:RegionManager.RegionName="{x:Static local:RegionNames.TabRegion}">
                <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource RoundedTabItem}">
                    <Setter Property="Header" Value="{Binding Content.DataContext.HeaderInfo}" />

The TabRegion in this case is a local region that is scoped to an instance of this view that is associated with an employee.


Jan 26, 2010 at 11:00 AM

Hi all, I don't know whether I am missing something or not? Coz as I recognized, the question is can we have multiple windows in a Shell (or multiple Shells) in PRISM?

The reason is that I am interested in multiple windows in a WPF Composite App. However, I haven't found one, any one is having one yet??

Thank you.

Jan 26, 2010 at 12:00 PM

Hi, about, asked when I didnt really try the thing yet. As I can see, we can use a work around is that we can mark the DockPane to be floating. However, that is still a workaround. Is there anyway that we can have multiple windows, as the CAL Documentation mentioned.


Thank you.

Jan 26, 2010 at 6:03 PM

Hi Arthur,

I have created a blog post that discusses this scenario and provides a small repro sample. You can read more about it here.

Please let me know if this helps.

Damian Schenkelman


Apr 21, 2010 at 2:54 AM

Hi Damian,

I went through the post you had provided for the Multiple shell and regarding that I have a question for you. 

In my application I have a requirement to load multiple shell windows based on how many of them, user had opened before quitting the application last time. 

I have Prism to load different modules at runtime and then load different views into regions. So, looking at the sample provided by you I think it is not possible for me to create multiple instances. Can you pls help me out on this?




Apr 21, 2010 at 8:30 PM

Hi Vijay,

As creating the Shell(s) is part of the Bootstrapper’s responsibilities (explained in this article), there should be no problem in adding some specific functionality to load multiple Shells in the CreateShell method.

For example, assume you are saving the Shell windows from a previous run (in any kind of storage), which a service implementing IShellPersitencyService is in charge of retrieving. The following simplified pseudo-code is a viable implementation:

protected override DependencyObject CreateShell() {
    ShellConfig config = Container.Resolve<IShellPersitencyService>().GetPreviousShellConfiguration();
    Shell1 shell;
    if (config.Count == 2)
        //do something
        shell = new Shell1();
        Shell2 shell2 = new Shell2();
        RegionManager.SetRegionManager(shell2, this.Container.Resolve<IRegionManager>());
return shell; 

Take into account that the component in charge of retrieving the old configuration should be fast, since the user is probably expecting a quick application startup.

Please let me know if this helps.

Damian Schenkelman


Apr 27, 2010 at 1:25 AM

Hi Damian,

Apologies for a delayed response. I was off for a week.

I understand what you are saying in the sample (similar what you have done previously) but is it that I need to load the regions and the modules (DLLs) again? 

To be more specific, my Shell Window has a region called as "ShellMainRegion", which is loaded with a view which in turn has "FloatingConsoleRegion" or "ListsRegion" (this is to identify the different user controls), this floating console region loads the Tab control which itself has two regions for 2 tabs on it. The individual tab items themselves have regions of their own to load multiple views respectively. 

So in your scenario above, do I need to load all those DLLs again to show the views in the respective windows of shell (in case of multiple instances).



May 24, 2010 at 9:19 AM
Hi, You can use the Window region adapter, when adding views to that region it shows a new window (that window itself will have its own scoped regions)