Modules load OnDemond using MEF !!

Topics: Prism v4 - Silverlight 4
Jun 21, 2011 at 3:58 PM

Dear all,

I have defined my modules to be loaded WhenAvailable and it is working fine, I now need to define some modules to be OnDemand.

Here is what I did:

I added the module to my xaml catalog file as follows: 

<Modularity:ModuleInfo Ref="Modules.AVT.xap" InitializationMode="OnDemand" ModuleName="AVTModule" />

Then I add the class that implement the IModule as follows: 

[ModuleExport(typeof(AVTModule), InitializationMode = InitializationMode.OnDemand)]
public class AVTModule : IModule
{
	[Import]
	public IRegionManager RegionManager;
	public void Initialize()
	{
	}
}

Then from my MenuModule I call the view from the specified module as follows: 

regionManager.RequestNavigate(RegionNames.MainContentRegion, MyViewUri);

But it doesn't show up...!!

What do I miss here

Regards

Waleed

Jun 21, 2011 at 10:19 PM

Hi Waleed,

Based on my understanding of your scenario, you need to call the ModuleManager’s LoadModule method in order your AVTModule gets loaded.

You can read more about how to load modules on demand here.

I hope you find this information useful.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic