This project has moved. For the latest updates, please go here.

Simple Import Question

Feb 16, 2010 at 3:16 PM


I have a pretty simple question. I have 2 xaps that I download dynamically a.xap and b.xap. When I download a.xap it has an <ImportMany("MainNavigation", AllowRecomposition:=True)>, and b.xap has the following:


    Public Nav1 As New TestNavigationItem


    Public Nav1 As New TestNavigationItem


Since both our downloaded at run time how do I get the current package catalog to? I know it works if I have a reference to that catalog like this:


Dim container As New CompositionContainer(catalog)


But since b.xap doesn't have a reference to the main silverlight application, how do I tell it to get the current packagecatalog that it is a part of?


Does that make any sense?



Feb 16, 2010 at 8:14 PM

So whoever is doing the downloading of the a.xap and b.xap is the one that needs to have access to the "global" catalog\container so they can update the catalog and cause recomposition to kick in. So who is downloading b.xap?

Feb 16, 2010 at 10:47 PM

Let me back up a few steps and explain better what I am trying to do.

  • Have a MainApplication.xap
  • Have an A.xap
  • Have a B.xap
  • The MainApplication.xap downloads a.xap and b.xap to a global catalog. 
  • a.xap needs to import b.xap

I would prefer a.xap not to have to a reference to MainApplication's assembly to get to the catalog it is a part of to keep that truly disconnected. Is that possible?

Feb 17, 2010 at 6:47 AM

jmarbutt, may be the following podcast help you use PackageCatalog to implement your idea.


Feb 17, 2010 at 5:31 PM

jmarbutt - Out of curiousity are you using PartInitializer.SatisfyImports? If you aren't you may consider looking into using that which would help eliminate for a.xap or b.xap from having to know about the container or the catalog.