John Papas Screen Presentaion Framework with Prism.

Topics: Prism v2 - Silverlight 3
Aug 30, 2011 at 8:12 AM

Hi Prism Team,

My name is Debashish Gupta.

I am developing a Silverlight Application in Prism Framework. I wanted MVVM Pattern, Event Aggregator, and Dynamic XAP Loading etc.

I based my application on the Application Developed by John papa Prim.Demo.UI Solution.

I got into Some Problem like.

In the Screen Presentation Framework the ViewModel & View Constructor is called once and it never gets called if a user clicks the same screen again from the Menu It just gets Visible in the Region again.

this.ViewModel = Container.Resolve<IPortfolioCreateViewModel>();
                this.View = Container.Resolve<PortfolioCreateView>();
                this.View.DataContext = this.ViewModel; 

Now I am not sure how can I send a data from One Module to another?

I wrote a separate Utils Class in the Infrastructure to share the data between the Modules.

I also cannot pass a ViewModel Object to the View’s constructor as I wanted to acess ViewModel methods from View Code Behind as well.

I needed some ways to resolve these things.

I tried to post this in the Silverlight Forum, they suggested to ask suggestions from prism team.

May be I am not able to use Event Aggregators Properly.


Debashish Gupta.

Aug 30, 2011 at 1:40 PM


You might find the following section from the Communication Chapter in the Prism MSDN documentation useful:

There you will find information about the Event Aggregator, which is useful to communicate between loosely coupled components (such as modules).

However, Event Aggregation is not the only way you can use to communicate between two modules without directly referencing them.

Depending on your requirements, you could use different approaches, mentioned in the following article of the prism documentation.

Additionally, if you need a sample you could try the Event Aggregation QuickStart which demonstrates how to build a composite application that uses the Event Aggregator service.

Also, you could try downloading the Prism Training Kit, which contains a Communication Lab with two exercises: One that uses Commands and the other one uses the Event Aggregator.

Agustin Adami