Creating new instances of a module

Topics: Prism v1, Prism v2 - WPF 3.5
Jun 16, 2009 at 7:28 PM

I'm working with the CAG guidance in a WPF application and trying to find a way to create new Instances of a module.

I am able to load several instances of a module in a region. I have a static class in the module with a private property ModuleName, which I populate in the LoadDefaultView method. It appears that when I load a new instance of the same module, the ModuleName (which I assumed would be a null) carries the name of the previous module created.

This makes me beileve I am not creating new instances of the module. Any idea this can be achieved?



- Arch

Jun 17, 2009 at 9:02 PM

Hi Arch,


If I understand your scenario correctly, you want to have multiple instances of the same view injected into a region. In Prism modules that contain different views can instance views several times to place them into regions. On the other hand, you should not create new instances of Module classes (that implement IModule).


The following articles from the Prism documentation have some pointers on how this is usually done:

·         How to: Show a View in a Region Using View Discovery UI Composition (Prism-v2)

·         How to: Show a View in a Region Using View Injection UI Composition (Prism-v2)

·         How to: Show a View in a Shell Region (Prism-v1)


You can also check out the UI Composition Quickstart solutions that come with the CAL. Links to the articles related below:

·         View Injection Composition QuickStart (Prism-v2)

·         View Discovery Composition QuickStart (Prism-v2)

·         UI Composition QuickStart (Prism-v1)


Please let me know if this helps.


Damian Schenkelman

Jun 18, 2009 at 2:11 PM

That's exactky what I want to achieve. Thanks Damian.