views:

205

answers:

2

I'm starting to train Prism (CAL) with a small application and faced some problems.

I'm creating multiple instances of my MainView, which itself contains some regions, and display them in the Shell. I'm using locally scoped regions to easily handle view injections within my MainView.

Currently I'm searching for a way of communication between the views (viewModels) inside the MainView. Composite events could do it, but when I publish those events, they are handled in all instances of my MainView, which I really don't want.

Is there a way of raising "locally scoped" composite events like with locally scoped regions? Or may be there's a better way of communicating between views in my case?

A: 

Pass form sender as an argument. (Anyway, there must be a way to distinguish your application's windows - use it.) When you recieve the event, check whether current form ReferenceEquals to sender (Or, check the form 'key').

portland
Thanks, I was thinking about using the key as one of the event argument.I'm only wondering, will it influence the performance of the whole application if I would have composite events everywhere, in every little region..
Shaddix
As soon as you fire event to global eventaggregator, every SUBSCRIBER has to work it out. So the answer is "Not in every little region, but only in region-subscribers"
portland
Thanks for clarification
Shaddix
A: 

It's also possible to create locally scoped EventAggregator and register in a child UnityContainer, created in the MainView (at the same place, where locally scoped region is created).

This is an equivalent to a locally scoped regions imho.

Shaddix