Hi,
Based on my understanding, in order to migrate the UI Composition HOL from Unity to MEF , first you will need to change how the classes are registered in the container. Basically speaking you will need to add the required attributes like Export and ImportingConstructor to the corresponding classes. If a class was previously registered through an interface in Unity (for example the UIMessagesService) you will also need to register it like this in MEF too :
Regarding changing the UI Composition method to navigation, it would be helpful to know which regions and views you want to manage through navigation, specially in an scenario similar to the aforementioned HOL where most views are being manually composed through presenters. Also, please take into account that currently Prism does not support the scenario of navigating to a view while attaching a scoped region manager to it. For example, if you navigate to a ProductDetailsView you wouldn't be able attach a region manager to in like in the OnProductSelected method of the ProductController class. Also, take into account that you will need to register the corresponding views to be used in navigation:
Finally, there are several approaches you can use to achieve the behavior you are mentioning. Which one is most suitable will depend of your personal preferences and the requirements of your scenario. For example, if you want to change the contents of the BottomRegion upon selecting a product or a spare part, a possible approach could be to bind the SelectedItem property of the DataGrid to a property in the view model:
I hope you find this useful,
Damian Cherubini
http://blogs.southworks.net/dcherubini
Based on my understanding, in order to migrate the UI Composition HOL from Unity to MEF , first you will need to change how the classes are registered in the container. Basically speaking you will need to add the required attributes like Export and ImportingConstructor to the corresponding classes. If a class was previously registered through an interface in Unity (for example the UIMessagesService) you will also need to register it like this in MEF too :
[Export(typeof(IUIMessagesService)]
. After that you will need to refactor the WorkshopBootstrapper to inherit from the MefBootstrapper class and configure it accordingly. You can find more information about the differences between Unity and MEF in the following chapters of the Prism documentation:Regarding changing the UI Composition method to navigation, it would be helpful to know which regions and views you want to manage through navigation, specially in an scenario similar to the aforementioned HOL where most views are being manually composed through presenters. Also, please take into account that currently Prism does not support the scenario of navigating to a view while attaching a scoped region manager to it. For example, if you navigate to a ProductDetailsView you wouldn't be able attach a region manager to in like in the OnProductSelected method of the ProductController class. Also, take into account that you will need to register the corresponding views to be used in navigation:
[Export("ViewClassName")]
. You can find more information about this in the following chapter of the Prism documentation:Finally, there are several approaches you can use to achieve the behavior you are mentioning. Which one is most suitable will depend of your personal preferences and the requirements of your scenario. For example, if you want to change the contents of the BottomRegion upon selecting a product or a spare part, a possible approach could be to bind the SelectedItem property of the DataGrid to a property in the view model:
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
. Then in the setter of the view model's property, you could react when the selected item is changed and change the views in the BottomRegion . Another example of a different approach is what the UI Composition HOL does in the OnProductSelected method of the ProductController class.I hope you find this useful,
Damian Cherubini
http://blogs.southworks.net/dcherubini