I am developing an application currently using Prism and MEF.
I would ideally like to generate a toolbar or menu with an item for each module, and when an item is clicked, only the views declared within that module load into a tab control.
For example:
Menu Region: ModuleA(Selected) | ModuleB
Tab Region: ModuleAViewA | ModuleAViewB | ModuleAViewC
Changes to Menu Region: Employees | Inventory(selected)
Tab Region: Items | In Fi
There are a lot of questions similar to this on here. In general, the approach you'll take is to define a service in an infrastructure DLL that your modules can reference. Your modules will add menu / toolbar / ribbon item / whatever objects through the service. Where the service is implemented is up to you - it can be in the Shell project, the infrastructure, or in a seperate module. Obviously, if its in a seperate module, you'll have to make sure that your other modules define it as a dependency.
You may want to check out the following:
This one has a link to a project demonstrating a dynamic menu: Looking for Prism example of Modules loading themselves into a menu
In which I ask a question on how to build a dynamic menu: How to dynamically add MenuItems (with a header) to a WPF menu
More.... Load Module Default Views In Region to Create Menu
And more! Menu service in Prism application CAL
You can find more than this as well out there. This has been a fairly common request; I'm sure you can piece together a good approach for doing this from the code samples out there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With