ViewModel distributed in different assembly

Apr 14, 2011 at 2:03 PM

I have an application with a shellViewModel and Bootstrapper. The ShellView can load different Modules, which are each reside in its own assembly. I override the assembly load method in the bootstrapper to do that. The Views of the Modules are shown perfectly (I used WindowManger.ShowWindow(module) for that), but now comes the point, where i run into problems. The Modules share some user controls, which are also designed with the view-viewmodel pattern. I have a UserControl Assembly for them. I couldn't get the user-controls show their Views, I always get the ViewModel Name displayed, where the views should be. I have tried to assign seperate bootstrapper to the modules, but nothing worked.

Apr 14, 2011 at 2:06 PM

Are you confident that the controls Assembly is loaded and registered in the Caliburn.Micro.AssemblySource.Instance collection? 

Apr 14, 2011 at 2:27 PM
I used protected override IEnumerable<Assembly> SelectAssemblies() and there
 Assembly.LoadFrom("MyControls.dll") to get the Assemblies loaded.
Apr 16, 2011 at 1:42 PM

Do the views live in the same namespace of the ViewModels? Are they named according to the convention?
CM supports, by default, just one naming convention: My.Namespace.MyViewModel -> My.Namespace.MyView

Apr 18, 2011 at 10:07 AM

I have placed them in the same namespace. But after searching in the discussion list I found a topic about Controls, arranged from AvalonDock. I am using Infragistics XamDockingManager and obviously you can't bind a ContentControl of a DockingPane to a View with a ViewModel Property. So I'll try the solution which was posted in AvalonDock and Loading Views/ViewModels in code

Apr 18, 2011 at 12:54 PM

I suppose that such solution should fit your needs. Extending the WindowManager or creating a service to handle docking is the simpler way, in my opinion, regardless of the docking implementation.

Apr 19, 2011 at 7:30 AM

I have actually created a docking service that uses the XamDockManager. When I get home tonight I'll upload the code for it.

May 26, 2011 at 3:40 PM

If you still need the code for this I have uploaded it to bitbucket and created a blog post that explains a little bit about it.

Apologies for taking so long to get back to you!