Binding to a View in an External Assembly (Silverlight)

Jan 4, 2011 at 4:34 PM

I am using Caliburn in a Silverlight 4 application. I use the standard view-model-first approach based on binding by convention.

I have now defined a view model and a view in a separate assembly. When I instantiate the view model it is looking for the correct View but does not find it.

Do I need to do anything special to the view in the external assembly to make it visible to the application (MEF??, Bootstrapper??)?

Any help would be really apprechiated

Markus Seeli

Coordinator
Jan 4, 2011 at 4:48 PM

The assembly that contains the view must be added to the AssemblySource.Instance. This is a list of assemblies that are checked for views. If the assembly is statically defined, you can add it by overriding SelectAssemblies in the bootstrapper and returning all the assemblies that contain views. By default, this method only return the assembly that contains your application. If you are dynamically loading the assembly, you can manually add it to AssemblySource.Instance at anytime during program execution.