This project has moved and is read-only. For the latest updates, please go here.

Sharing the Model (MVVM) across Modules.

Apr 20, 2010 at 1:29 PM

I've just about got the hand of the very basics when it comes to MEF, but I'm struggling with slightly more complicated scenario...

  • I have a Silverlight application, that follows the MVVM pattern. Its purpose is to display widgets (unknown content), in a dashboard like view.
  • Each widget is self contained within its own module (XAP file). 
  • The main application downloads x number of widgets at startup, and then displays them in an items control.

Up to this point, things are going well. The user logs in, the modules are downloaded and the user can see each widget in the itemscontrol, based on a binding to a main application viewmodel which imports the widgets (ImportMany). 

However, the problem is inside each Widget... although the View and ViewModel are self contained, the widgets ultimately want to reference the same, Singleton instance, of the model. Effectively they are different representations of the core data from a model.

Can anyone recommend a way I can have a shared model across the widgets?