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

Dynamic XAP Loading

The simplest way to dynamically load a module in Jounce is to bind a view to the XAP file it lives in (see: Binding Views to Xap Files) and then navigate to the view.

Sometimes you require more control and may need to explicitly load the XAP file.

Use the deployment service for this:

[Import]
public IDeploymentService Deployment { get; set; }

The service provides two methods: one to load a XAP file, and another that will load the XAP file and then call back with an exception if an exception occurred. Calling the service is straightforward, as demonstrated in the calculator quickstart:

Deployment.RequestXap("DyanmicXapCalculatorAdvanced.xap");

If you have any code that should run once a module is loaded, read Bootstrapping Modules.

Last edited Mar 27, 2011 at 4:26 PM by jeremylikness, version 3

Comments

KHappe Aug 30, 2011 at 8:28 PM 
Concerning the Copy Local = False for Jounce. Is there any other way to handle this error. We would like for the views to be debugable stand alone and also loaded by the shell.

PaulLinton Oct 15, 2010 at 12:21 AM 
In the dynamically loaded module make sure that the references to Jounce.* are set to be Copy Local = False. Failure to do so will give MEF errors
'Change in exports prevented by non-recomposable import'