Global Commands and Command Controllers

Topics: Prism v2 - WPF 3.5
Dec 29, 2009 at 2:28 PM


I am new to Prism and I need to define Commands that are global to my application.
These commands, for instance "create product", can be triggered in more than one view in
my application. For example, the user can ask to create a product from the main menu
that is in the MainHeader Module or from Quick Access Toolbar that is treated by another

The commands must be global and must be treated by one class. Maybe a CommandController
class. How can I define a GlobalCommands that are in fact executed by one class.

My current version is using EventAggregators. I have a global CommandId table and the
modules that execute the commands fire an event that is subscribed by the
CommandController class.

But in this case I have, in fact, local commands that notify the global controller using

Is it the best practice ???

How could I define the commands globally and drive their execution to the same class
no mather which module triggered them.

Thanks in advance


Dec 30, 2009 at 7:39 PM


For this kind of scenario, you could use Composite Commands. You can read about composite commands in the following articles from the Prism documentation:

The Prism RI and the Commanding Quickstart solutions that come with Prism use composite commands, so you might find them useful as well.

Please let me know if this helps.

Damian Schenkelman