Pass Data between Modules and Load New Module

Topics: Prism v2 - WPF 4
Oct 20, 2010 at 1:37 AM

Hi all,

I try to explain myself clearly. Say I have an application with 2 regions in shell: Menu bar, main region. As name indicated, I host a menu bar in menu bar region; and main region is the main area my application works.

I created several modules to host in main region as well. Let's say the first module is customer search module/view, there are some text boxes to let user enter search conditions, and there is a button to load list of customers. If user wants to see details of selected customer in the list, I would like to:

  • unload current module/view from main region;
  • load a different module/view (customer detail module/view) to main region;
  • pass selected customer object from customer list module/view to customer detail module/view;

The problem is that module is not aware of other modules, I can use event aggregator to publish events, but how can I broadcast customer object as parameter while event is publish? And how can I inform shell to load proper module (customer detail module/view) from customer list module/view?

Thanks

Hardy

Oct 20, 2010 at 2:51 AM

Never mind my question, I figured out.

Oct 20, 2010 at 3:37 PM

Hi Hardy,

Nice to see that you figured out this. Additionally, take into account that the Stock Trader Reference Implementation provides guidance on this topic.

I would like to share the following link on MSDN for other users with a similar scenario: Event Aggregator

Fernando Antivero
http://blogs.southworks.net/fantivero