I found these two to be very helpful:
http://www.codeproject.com/KB/WPF/blendable_locator.aspx
http://rickrat.wordpress.com/2011/01/24/using-mef-to-link-view-model-locator-and-load-assembly-uis-dynamically
The first one is just a simple drop-in viewModelLocator class for MVVM Light that gives you the MEF abilities.
[ExportViewModel("Demo1", false)]
class Demo1ViewModel : ViewModel
{
}
And the second one, uses the same approach with an additional MefHelper class that enables run time loading of MEF components.
public void Compose()
{
AggregateCatalog Catalog = new AggregateCatalog();
// Add This assembly's catalog parts
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
Catalog.Catalogs.Add(new AssemblyCatalog(ass));
// Directory of catalog parts
if (System.IO.Directory.Exists(ExtensionsPath))
{
Catalog.Catalogs.Add(new DirectoryCatalog(ExtensionsPath));
string[] folders = System.IO.Directory.GetDirectories(ExtensionsPath);
foreach (string folder in folders)
{
Catalog.Catalogs.Add(new DirectoryCatalog(folder));
}
}
_Container = new CompositionContainer(Catalog);
}