How to communicate Global Variable in Stock Trader RI ?

Topics: Prism v4 - WPF 4
Apr 6, 2011 at 2:26 PM
Edited Apr 6, 2011 at 2:26 PM

What is the best method to share a Global Variable among all the modules in the Stock Trader Reference Implementation ?

In my case, I added a combobox in Shell.xaml where the user will select an item and I want to communicate that global to all the modules to filter what the modules display.

But how do I communicate it to the modules? Can I make it visible via the Infrastructure module somehow or is there some other method?

Thanks

Apr 6, 2011 at 4:29 PM

I assume you have ViewModel for your Shell.xaml. So you have property binded to this combobox.

In setter for this property you can send message (via event aggregator) with value of the property..  Modules which are interested in this value/message will subscribe and get value in eventHandler for subscribtion..

 

There is another way - via common service/class available in all projects. But first ways is easier and faster - what leads to less potential errors -)