Dynamically add module/view to a region?

Topics: Prism v2 - WPF 3.5
Mar 12, 2010 at 7:28 PM

Is it possible to dynamically add a module to a region?  For example, I want to use a module/view in several regions.  I add the module to the catalog via 'return new StaticModuleEnumerator().AddModule(typeof(NewsModule))' and it is assigned to the region detailed in the module itself.  How could I use this module in another region as well?  Can I inject the region into the module after it is loaded?


Mar 18, 2010 at 1:16 PM


Regions usually don’t hold modules, but rather views. As explained in the UI Composition design concept, views are defined in modules. You can check this thread for further information on the subject.

To dynamically insert a view in more than one region, you should use View Injection, and you should add a different instance of a view to the different regions. You can find more information about this in the following thread:

Inserting a View in more than one Region.

I hope you find this helpful.

Guido Leandro Maliandi


Mar 18, 2010 at 2:47 PM

Thanks for the links Guido!