Modlularity using MEF issus...

Topics: Prism v4 - Silverlight 4
Sep 17, 2010 at 2:48 AM


I am trying to load a view (MVVM) from a module into region and am having a MEF issue.

I am using behaviors to tie events from my view to my viewmodel but it seems to be causing a problem with MEF.

In my view I have defined this:


        <Button Content="Save Products" HorizontalAlignment="Left" Height="21" Margin="157,8,0,0" VerticalAlignment="Top" Width="117">
                <i:EventTrigger EventName="Click">
                    <i:InvokeCommandAction Command="{Binding SaveProductsCommand}"/>



This is the error I'm getting when I try to load the view into the region:


The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) The attachable property 'Triggers' was not found in type 'Interaction'. [Line: 16 Position: 33]

 Resulting in: An exception occurred while trying to create an instance of type 'PointOfService.ProductsView.

 Resulting in: Cannot activate part 'PointOfService.ProductsView.

Element: PointOfService.ProductsView -->  PointOfService.ProductsView -->  AssemblyCatalog (Assembly="PointOfService, Version=, Culture=neutral, PublicKeyToken=null")

 Resulting in: Cannot get export 'PointOfService.ProductsView (ContractName="PointOfService.ProductsView")' from part 'PointOfService.ProductsView.

Element: PointOfService.ProductsView (ContractName="PointOfService.ProductsView") -->  PointOfService.ProductsView -->  AssemblyCatalog (Assembly="PointOfService, Version=, Culture=neutral, PublicKeyToken=null")



If I comment out the Interactions.Triggers block then the region displays the region without any problems.

Can anyone shed some light on this plz!




Sep 17, 2010 at 2:56 AM

Hi All,

I found a solution: from Gazficko at the bottom.


I referenced the Microsoft.Expression.Interactions.dll in my shell app and it worked fine.


Sep 17, 2010 at 2:11 PM

Hi Darren,

Nice to see that you found the solution. Thanks for sharing this with the community. It doesn't seem to be related with Prism, so I will not create a work-item for this. Please let me know if I'm wrong.

Fernando Antivero

Sep 20, 2010 at 12:50 AM

hi Fernando,

I very new to Prism so i'm not sure if it is an issue or not.
My thinking leads me to believe it is an issue but i might just be missing somthing. I would have thought that I would be able to add the reference required to only the module in question and that none it wouldn't be required in the shell project. If it is truly modular and decoupled why would the scheel project need to know about the referenced dll in the module project?

What are your thoughts?



Sep 20, 2010 at 8:37 PM

Hi Darren,

Your thoughts are reasonable. At first, I thought that it was not a work-item, since I didn’t realized that you need to add this to your Shell project for something required in your modules.

It means that if you add this assembly to your module (not shell), it throws an exception. Do you have a repro sample of this? I would like to open a work-item if it does not work as expected.

Thanks for reporting that.

Fernando Antivero