Multiple Shells

Topics: Bootstrappers & IoC
Sep 14, 2011 at 9:04 PM
Edited Sep 14, 2011 at 10:05 PM


I try to achieve the same as MS Word, where each document is opened in a new App window.

I assume the way to do this is to open multiple Shells.

The event is handle in the bootstrapper:

public void Handle(NewShellEvent message)

I already did the same in Prism:


var regionManager = Container.Resolve();
var newRegionManager = regionManager.CreateRegionManager();
var neweventAggregator = new EventAggregator();
var shell = new Shell(newRegionManager, neweventAggregator);

How to achieve the same in Caliburn?

My current approach is:

                IEventAggregator inst2 = new EventAggregator();
                ShellViewModel inst = new ShellViewModel(inst2);
                IWindowManager manager = Caliburn.Micro.IoC.Get();

I looks a bit too good to be true. Is it really that simple or do I miss the trick here?


Sep 20, 2011 at 9:42 PM

It seems fine to me.
Since the ShellVM is no longer "singleton", however, you obviously can't quicly get its instance from the IoC anymore (which is a tecnique I find useful).
You have to rely on EventAggregator or collect the spawned Shell instances in a registry in order to reach/enumerate them (not sure you will need this, however).