Beginning Prism Development Part 2

In our last article we looked at the structure of the HelloWorld sample application and the detail of the bootstrapper.cs file.


 Create Shell


In bootstrapper.cs we assign our shell class and call it with App.Current.MainWindow.Show().





In the shell you will notice an ItemsControl named MainRegion.  Regions are tagged locations that Prism can load views into.  Commonly the shell will have regions for:

  • MainRegion for a form workspace
  • Navigation
  • Menu
  • Notifications

The shell file only assigns where and how a region will be.


Here is the shell running without any regions defined.

Empty shell 




Module structure

HelloWorldModule is a separate project file.  Prism allows each module to be is own project.  It uses dependency injection and communication frameworks to allow the projects to work together.

HelloWorldModule has two files we will review, HelloWorldModule.cs and HelloWorldView.xaml.



The Prism framework automatically calls and runs the HelloWorldModule.  It will do this with as many modules as desired.


The module is using dependency injection to create a reference to region view registry.  This object is used to assign a view to a region. Here we are assigning the HelloWorldView form to the MainRegion region. 





The Xaml of the HelloWorldView contains a TextBlock with some text to see if the module successfully loaded.


Hello world running


Here is how the programs looks after a successful compile.

Leave your comment