Navigate to modules (xaps)

Topics: Prism v4 - Silverlight 4
Nov 16, 2010 at 4:10 AM


When to use the below with MEF

  • RegionManager.RequestNavigate : as per my understanding this is only for views within the same project where the Region is defined
  • ModuleCatalog : for downloading views in another silverlight application within the same project solution?
  • DeploymentCatalog : for external xap's

What would be the best way? Can we use Request.Navigate for navigating to views in another silverlight application in the same project solution?



Nov 16, 2010 at 2:58 PM
Edited Nov 16, 2010 at 3:00 PM


In Prism the DeploymentCatalog class helps on downloading the .xap files and discover assemblies/types within those xap files. From the documentation:

  • "Managed Extensibility Framework (MEF) does not provide a mechanism for associating modules with the XAP file to download. Prism's ModuleCatalog continues to be used even when using the MEF container to support on-demand and background downloading.
    Behind the scenes, the MEF DeploymentCatalog is used to download XAP files, and Prism keeps the ModuleCatalog updated as MEF discovers new modules."

If you want more guidance on this topic, you could take a look at the following documentation sections:

Regarding to the Navigation in Prism, you could navigate to a particular view, which resides in a ModuleX and displays it in a Region declared in the Shell project. If you need more guidance on this topic, you could check the View-Switching Navigation Quickstart.

You can find below that in the aforementioned quickstart you have 3 project with different views and that they are displayed in the MainContentRegion in the Shell project.

Please let me know if I missing something. If you have any problem implementing this in your application, could you please share a repro sample?

Hope this helps.

Fernando Antivero


Nov 16, 2010 at 3:52 PM

Thanks Fernando. That was helpful.

I actually figured this out with looking at the help documents and few of the quick starts.

I had to work out 3 different scenarios by making use of RequestNavigate, as I needed to pass parameters to the views, without having to use event aggregators

  • Load a view in the same project as the Shell : this was straight forward as I did a Export on the view with a contract name and then just did a _regionManager.RequestNavigate("RegionName", new Uri("ViewExportName" + query, UriKind.Relative))
  • Load view from another silverlight application under the same project solution : for this I added the module in the modulecatalog. Once the module got downloaded did the same as above by using the views export name.
  • Load a view in an external silverlight application under a completely separate virtual directory : for this I downloaded the xap using a DeploymentCatalog and did the above on download completed.

The idea was to, as I said, to make use of the Navigation framework and eliminate the use of event aggregators for passing parameters between modules. Also I didnt want to predefine the modules to load in specific regions in their IModule implementation. In effect the modules being downloaded need not know anything about regions. I wanted the Shell to have full control on deciding where each view should be placed in the regions defined.

Doing the above gave me the flexibility.

Not sure if I'm on the right track, but I guess it does resolve my concerns :) . Also with this implementation i was able to implement nested regions. Let me know your opinion !!