How to Dynamically load EXTERNAL MVVM and NON MVVM controls ?

Topics: Conventions, Getting Started, UI Architecture
Oct 6, 2012 at 11:23 PM
Edited Oct 6, 2012 at 11:23 PM

I am loading controls dynamically from the web server from separate XAP files. After creating an instance I want to show them in tab Pages. The controls can be MMVM controls using CM but also non MVVM standard controls.

Before trying the tab I tested to simply show a control dynamically on the page by using:

<ContentControl Name="TestControl" />

Test control is a property of Type UserControl which is set via creating a new Instance of a dynamically loaded control. Now this gives me an error that it can't ind the view. In case of non MVVM controls there is of course no view, so how do I load  a non MVVM control ?

I tried to make the test control a MVVM control, but still get the cannot load view error. Makes sense as such instance is not created. If I create an instance of the dynamically loaded view besides the view model, how do I "Add" this so that CM finds it ?

Lats but not least, how do I bind this to a tab control in Silverlight  ? The  idea is to have a collection of user controls (plug ins) which get each rendered in its separate tab page.

Thanks for any help
( I got this done in no time NOT using MVVM, still not sure if all the complexity is worth the MVVM)