Event subscribers? Views versus Regions?

Oct 29, 2008 at 10:12 AM
Hi all,

just wondering if I could get some help with something?

I currently have ModuleA.View1 publishing an event, and ModuleB.View2 subscribing to it. This all works fine.

I then wanted to use these events to dynamically load Views into various regions. In effect, a menu system that loads Views into my MainRegion.

For this to work, the subscriber needs access to IEventAggregator (so it can subscribe to the event) and IRegionManager (so it can hide/show/activate the Views).

Can I use injection to give a View access to IRegionManager? Because at the moment it looks to me like Modules have access to IRegionManager, and Views have access to IEventAggregator, but nothing (that I've discovered) has access to BOTH.

as always, thanks in advance.


Oct 29, 2008 at 4:20 PM



Yes, you can inject the Region Manager in your views/presenters and use it to load a view into a region. Moreover, a good practice could be to have a Controller class that handles the loading of views, as the controllers are usually used to coordinate the activity of multiple views.


The UI Composition QuickStart shows a sample implementation of a typical controller class in the UIComposition.Modules.Employee\Controllers\EmployeesController.cs file (this controller coordinates the interaction of the Employees module's views).


If you need more information about controllers you can review the Employees Controller section of the UI Composition QuickStart article.


Please let me know if this helps.


Mariano Converti

Nov 3, 2008 at 7:23 PM
I am following the PrismV2 codedrops with figurative business case sample. The current version of authentication module is implementing a controller between presenters. You can see the source code SL2WithPrism in CodePlex