Steve.NayLinAung Steve.NayLinAung - 1 month ago 5x
Bash Question

Prism: How to load Default View in Shell Region with Unity Bootstrapper

When I look Prism Navigation QuickStart demo, it uses Mef Bootstrapper and use

interface in
file to load default view into the Shell Region as following.

public partial class Shell : UserControl, IPartImportsSatisfiedNotification

public void OnImportsSatisfied()
this.ModuleManager.LoadModuleCompleted +=
(s, e) =>
if (e.ModuleInfo.ModuleName == EmailModuleName)

In my project, I use Unity Bootstrapper and try to reference this demo for loading default view. As expected, it totally does not work.

Please, share me suggestions and some recommendations on "How to inject Default View into Shell Region with Unity Bootstrapper".


Assuming you have a CreateModuleCatalog override in your bootstrapper, you use it to add a module to the catalog.


In the YourModule Initiaize override, register the view you want displayed like below.

Using view discovery:

RegionManager.RegisterViewWithRegion("YourRegion", typeof(YourView));


Using view injection (if you want a little more control, or need a scoped region, etc.):

IRegion region = _region_manager.Regions["YourRegion"];
var view = _container.Resolve<YourView>();
region.Add(view, typeof(YourView).FullName);

This injection method needs you have to a reference to the region manager, and you have registered the view with the Unity container, and you have a reference to the container

As long as the YourRegion region is in your Shell xaml, and is visible at runtime, the YourView will show in it.

The Hello World quick start shows this too, and uses the Unity container.