Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Applies to Silverlight 4 and 5
In the previous recipe, we used the ViewModelLocator to connect our Views to our ViewModels. Another approach you can take is to use the Managed Extensibility Framework (MEF) to do this for you.
One of the advantages of this approach is that besides relaying the responsibility of providing the ViewModels to MEF, you can now use multiple ViewModel instances of the same type without having to create a ViewModelLocator property for each, for example: you can use this approach if you don't know in advance how many instances you'll need (amongst some other advantages, which will be described in this recipe).
In this recipe, you'll learn how to use MEF for tying your Views to your ViewModels.