|
I'm trying to load a catalog from XAML in WPF. I've done this successfully in Silverlight (mainly because the example's in the ref docs were for Silverlight) however when I try to do the equivalent in WPF I get the following error when the Boostrapper
trys to load a module from the XAML derived catalog:
ModuleTypeLoaderNotFoundException
There is currently no moduleTypeLoader in the ModuleManager that can retrieve the specified module.
Here's what I have for the catalog (Catalog.xaml):
<Modularity:ModuleCatalog
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Modularity="clr-namespace:Microsoft.Practices.Composite.Modularity;assembly=Microsoft.Practices.Composite">
<Modularity:ModuleInfo
Ref="Modules/MyAssembly.dll"
ModuleName="ShellModule"
ModuleType="MyNamespace.MyModule, MyNamespace" />
</Modularity:ModuleCatalog>
It's loading OK from here (in the Bootstrapper):
protected override IModuleCatalog GetModuleCatalog()
{
var uri = new Uri("/Catalogs/Catalog.xaml", UriKind.Relative);
var catalog = ModuleCatalog.CreateFromXaml(uri);
return catalog;
}
A breakpoint shows that the catalog is actually loaded, and contains one item. The exception is thrown from within
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
new Bootstrapper().Run();
// Exception thrown from here.
}
}
Can someone point out what I'm doing wrong here. Am I not declaring the XAML correctly? Thanks.
PS: My module works fine when declared within App.config and bootstrapped via the 'ConfigurationModuleCatalog'. However I want to do this via XAML so I have more control at time of boostrapping. That is to say I want to decide
to load different sets of modules defined in different XAML catalogs based on the startup criteria. Is that a sensible plan? Or is there a better strategy to deal with this kind of behavior? Thanks again.
Phil
|