How do display a UserControl with satisfying all imports

Posted by Yost on Stack Overflow See other posts from Stack Overflow or by Yost
Published on 2010-05-18T14:51:39Z Indexed on 2010/05/18 17:01 UTC
Read the original article Hit count: 343

Filed under:
|
|

Dear SO,

I'm having some issues with Silverlight 4/ MEF. I have a basic framework setup with a Silverlight Navigation app at the core.

Image link to the diagram for clarification

The main app (Desu) contains some pages and controls that export en import nicely. I dynamicly load controls from Desu.Controls(like an imageviewer which i identify with the IImageViewer interface) and some pages from Desu.Pages.

The first problem I had was with dynamicly loading pages and being able to navigate to these pages (eg. use dummyhttp://blagh/desutestpage.aspx#/Activation when Desu.Pages was loaded from the xap). I solved this by using a custom MetaAttribute and a custom contentloader.

Now for the question part: I want to load the ImageViewerControl from Desu.Controls in HomePage in Desu. I haven't loaded the Desu.Controls into the package though. When i try to load the control it gives me CompositionException because it can't satisfy the ImageViewControl import. I tried setting AllowRecomposition=true but that didn't help.

So is it possible to load a control without satisfying all imports and, if yes, how does one do this?

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about MEF