RegisterViewWithRegion MEF

Topics: Prism v4 - WPF 4
Jul 14, 2010 at 9:43 AM
Edited Aug 10, 2010 at 6:55 AM

Hi guys

first of all, i think the prism library is gr8t, and much anticipated, all the explanation i could find about the difference between using prism with mef vs. prism with unity lead me to the following conclusion

1. use mef if you are planing to integrate 3 parties

2. use mef or unity depending of how you would like the code to look (if you prefer mef syntax over unity syntax)

beside that i could not figure any thing else :(


I'm working with your drops, and wanted to say and ask a couple of things

1. the MEF sample application is very poor, and most probably fits your needs of testing, and has nothing to do with real world application

2. it took me ages to figure out that when using directory catalog (mef) the modules post build should copy only the modules and not the module reference dlls as well. if you don't follow this you get a weird exception  in ConfigureRegionAdapterMappings). also there is a need to reference Composite.UnityExtensions.Desktop for some strange reason although im using MEF only.


3.  when i use the _regionViewRegistry.RegisterViewWithRegion("StatusRegion", typeof(StatusBar)) i get another weird exception at RegionViewRegistry.CreateInstance: "Activation error occured while trying to get instance of type StatusBar, key """

Jul 14, 2010 at 11:04 AM

found the answer: (3)

The view should have the [Export] attribute also



Jul 15, 2010 at 4:26 PM

Which application are you looking at, the modularity quickstart or the MVVM RI?

We'll see if we can add something in the guidance about working with disconnected modules and deploying them as build steps.


Jul 15, 2010 at 7:48 PM
Hi brumfb thanks for the answer, I'm talking about the modularity - which currently, is the only sample involving MEF, the RI application is unity based
Jul 15, 2010 at 11:23 PM

The Modularity Quick Starts are meant to show most of the standard scenarios that are possible.  If you want to see the simplest way to do on demand loading, for example, between the code and the docs (which we are working on and should be in the next drop) you should be able to grasp the concept of modularity in isolation.  For more complex and closer to "real world" scenarios, we have the reference implementations (the stock trader and the survey). 

What did you expect from the quickstarts?  A starter solution/soluton template? Or something else?

What else would you want to see demonstrated in either the quickstarts or the reference implemntations that we are not showing?


Michael Puleio

Jul 17, 2010 at 4:17 PM
Edited Jul 17, 2010 at 4:20 PM
Hi Michael, glad to hear you are working on the documentation for the next drop. The RI application is currently Unity based, and as far as i see it (according to Prism team members blogs) MEF is the real highlight of the V4 release.
regardless, the RI IMHO is not a real world application in the sense of the wind drift in the forms/issue tracker. most of the users are talking about toolbar (normally ribbon), tree view module, and main module. async communication, responsive UI.
in my case, i have an unresolved issue while i tried to compose two module in the same shell using MEF. This simple situation should work out of the box even in drop version - but it does not (both for silverlight and WPF), another one simple situation IMHO is the region manger that does not have any views.

if proper samples where supplied, I'm sure you would catch these issue before delivery, and make some of the community more "happy" with out of the box working samples.

Michael, I'm willing to contribute such samples - but I'm not sure how.

some examples
Jul 19, 2010 at 5:53 PM

Thanks for the feedback.  We have plans to convert the Stock Trader RI to use MEF, which should help us both show a more "real" (or at least closer to real) app using MEF and tease out a few issues that the minimal quickstarts don't expose. I'll also look at the issue tracker problems you mentioned and see if we can get them fixed soon.