Cannot find views when control hosted in WinForms application

Topics: Bootstrappers & IoC
Feb 10, 2014 at 3:56 PM
Hi,

I have a WPF application which works correctly when run as the startup project but which fails to locate the views for my viewmodels when it is hosted in a winforms application. The views and viewmodels are located in the same project under the namespaces:
RopeAccess.WPF.Manifest.Views and RopeAccess.WPF.Manifest.ViewModels.

I have tried overriding the SelectAssemblies method with:
        protected override IEnumerable<Assembly> SelectAssemblies()
        {
            yield return Assembly.GetExecutingAssembly();
            yield return typeof (ManifestBootstrapper).Assembly;
            yield break;
        }
and the constructor for my bootstrapper is as follows:
        public ManifestBootstrapper(ElementHost host)
            : base(false)
        {
            SetupIoC();
            var shellViewModel = _kernel.Get<ManifestShellViewModel>();
            var shellView = _kernel.Get<ManifestShellView>();
            ViewModelBinder.Bind(shellViewModel, shellView, null);
            host.Child = shellView;
        }
This correctly loads the Shell into the ElementsHost but all child views inside the shell display as "Could not find view for RopeAccess.WPF.Manifest.Viewmodels.X"

I have also tried adjusting the namespace mappings for the ViewLocator such as:
ViewLocator.AddNamespaceMapping("RopeAccess.WPF.Manifest.ViewModels", "RopeAccess.WPF.Manifest.Views");
Is there something I am missing to allow Caliburn Micro to locate the views?