tags:

views:

55

answers:

1

Hi,

I have three views, each of which is is implemented in a user control. This all works fine when they are alone. When an item is selected in view one I need to notify the other two views that the item that they are looking at has changed.

I have looked at various ways of handling this but the one that keeps coming back as the better approach to me is to use events. I was wondering if anyone had any samples of how to do this in terms of an EventAggrergator/ Application Controller pattern?

James :-)

+2  A: 

This sounds like a good candidate for applying the observer pattern.

JohnIdol
I had looked at that but it seemed a lot of work to be done and everything that I was looking at pointed to an EventAggregator.
m0gb0y74
The EventAggregator will be used as an observer in this case. It is not a good fit and when it comes to maintaining the application not as clear. The extra work you down now by implementing an explicit observer will save you time and money in the long run. The explicit observer setup will make clear your intention.
RS Conley
You basically setup each of your views as observable. All of the views subscribe to changes of all the rest. You really have only to define 2 interfaces, IObservable and IObserver and have each view implementing both.
JohnIdol