Based on my understanding of your scenario, you might find Commanding concepts handy.
In a composite scenario, the command handler is often a view model that does not have any associated elements in the visual tree or is not the focused element. To support this, Prism provides
DelegateCommand, which allows you to call a delegate method when the command is executed, and
CompositeCommand, which allows you to combine multiple commands. These commands are different from the built-in
RoutedCommand, which will route command execution and handling up and down the visual tree.
CompositeCommands can be connected to several child commands.
For example your application could have global CompositeCommands that are defined in the shell that have meaning across modules, such as Save or Cancel commands. Modules can then register their local commands with these global commands and
participate in their execution.
Additionally, you can read more about Commanding in
Chapter 9: Communicating Between Loosely Coupled Components. Also, you might find the
Commanding QuickStart useful.
Please, let me know if this information helps you.
Sorry if I didn't explain my problem correctly, but wiring up commands is not really my problem.
Let me try to explain it. What I'm trying to get a grasp on is how I can show and hide each button. It might be really simple, but I haven't been able to find much information about it.
Let's say that I have a toolbar with my common buttons such as Save. To this specific toolbar, i need to add other buttons from my modules. For example, I have a OrderModule with a view called OrderSummary. When this view is requested (or any other view
in the OrderModule), I need to add a "New Order" button to this toolbar. When OrderModule no longer has an active view, the button should be removed again.
I was thinking about creating a "Service" with methods for adding buttons to this toolbar (the toolbar is defined in the Shell). But where should I control when to add and remove module-wide buttons?
Does it make any sense?