Hi,
Based on my understanding, if you want to define only one view for your different view models, then I believe a possible approach could be to export this view through an interface (e.g.ISearchView) defined in a common project. For example, this interface could define a property for the view model which should also respond to a common interface (e.g.ISearchViewModel), in order to establish a compatibility between the different view models and the common view. For example you could have the following property:
public ISearchViewModel ViewModel;
Then, in your modules you could define the logic to resolve the common view through this interface and also set its
ViewModel property with the view model provided in this module to handle the search operation. And then once you have the resulting view with its corresponding view, for example you could inject the this view in a region. Take into that if
you follow this approach, the view should be exported also using the following attribute:
[PartCreationPolicy(CreationPolicy.NonShared)]
As by default
MEF will register the class as a singleton instance, which may not be necessary for this particular approach. Also, take into account that this may not be the only aproach to achieve this as this will deppend mostly on your personal
preferences and the requirements of your scenario.
Please let us know if we have misunderstood your scenario,
Agustin Adami
http://blogs.southworks.net/aadami