I'm using Caliburn Micro for MVVM. Now I have the following situation. I have a UserControl with View and ViewModel in my first assembly assembly1 in namespace1. If I use it in an second assembly assembly2 that has the same namespace namespace1 (it´s in the same solution) everything works fine.
Now I'd like to use my ViewModel in another Solution with namespace namespace3. If I try this I always get the error, that View couldn't be located.
I build up a workaround that sets the Binding manually in the bootstrapper (using Ninject).
protected override void Configure()
{
_kernel = new StandardKernel();
_kernel.Bind<OverlayManagerView>().To<OverlayManagerView>().InSingletonScope();
_kernel.Bind<OverlayManagerViewModel>().To<OverlayManagerViewModel>().InSingletonScope();
base.Configure();
}
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
ViewModelBinder.Bind(IoC.Get<OverlayManagerViewModel>(), IoC.Get<OverlayManagerView>(), null);
...
}
This is working, but if I'd like to use my ViewModels from assembly1 I won't always set the Binding manually and as Singleton.
Is there a way to tell the Caliburn ViewLocator that Views might be at a different namespace?
I tried following not working...
ViewLocator.AddNamespaceMapping("namespace1", "namespace3");
ViewLocator.AddNamespaceMapping("namespace1", "namespace1");
ViewLocator.AddNamespaceMapping("namespace3", "namespace1");
Maybe someone knows a solution.