User Defined Module Loading using Prism

Topics: Prism v2 - WPF 3.5
Mar 6, 2009 at 5:05 PM
I am developing a application using a docking control. The idea is that users will be able to add whatever controls we give them access to, and some of them multiple times to their screen.
I want to use Prism, so that the Portlets can be developed by various application teams, and then when complete we can add them to the library for users to add to their desktop.

The examples I have seen (stock trader etc) seem to load the modules to a single page, what I need to be able to do is to create a new frame control, and then add the modules to that frame so it can be docked.

So on startup their is just an empty (infragistics) dockmanager control.

The user selects the modules they want from a drop down list. For each module I create a new dockmanager window and load the module into that window. Potentially the same module could be added twice (as the module may be configurable to display different data)

Is it possible to do this, and is their any sample code knocking around?
Mar 9, 2009 at 6:33 PM



The Prism-v2 Desktop Reference Implementation shows an example on how to show a view in a different window by using a behavior (RegionPopupBehaviors) defined over the shell window, which is creating a NewsReaderWindow in a Popup Region. 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. In his approach, Ignacio defined a new region adapter associated to views of Window type. 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.


Both approaches should work on your application so you should pick the one that meet your requirements the best.


Another thing that could be useful for you, if you have a lot of modules and only some of them will be used, is loading the modules on demand. You could load them based on the drop down list selection, so only modules that the user selects are loaded.


For more information about loading modules on demand you can check these articles:

·         How to: Load Modules on Demand

·         Modularity QuickStarts for WPF


And the Quickstarts’ solutions located in the $Decompression Directory$\Quickstarts\Modularity folder. The Modularity Quickstarts for WPF are:

·         ConfigurationModularity

·         DefiningModulesInCodeQuickstart

·         DirectoryLookupModularity



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