tags:

views:

204

answers:

1

Hi, I have a wpf composite application with 3 or 4 modules that will always be loaded. In my shell I have a toolbar with buttons to active corresponding views from these modules. I injected an IEventAggregator into the shell presentor so that when a button is pressed I can publish an event that the corresponding module controller has subscribed to. When the event is caught the controllor will active its view.

Thats the theory anyways, in practice my controller is not catching the event. There are no errors in publishing or subscribing. I thought at first that there might be an issue with the eventAggregator not being the same, but thats not the case, and the event has a subscriber when its published.

Can anyone think of a reason why the event is not getting caught? (Or any suggestions on a different way to get my view to show would be helpful too!)

+1  A: 

Hi Shaboboo,

Do you have your module controller 'alive'? Are you subscribing to the event using weak delegate reference or strong reference? Seems that what is happening is that your module controller is being disposed, and so, the event is not getting caught.

To subscribe with a strong reference, use the keepSubscriberReferenceAlive option on the Subscribe method.

You can check the Event Aggregator article from the documentation which might provide more insight.

If that still does not works, can you share your repro code with me so I can take a look to it? (ezequieljadib at hotmail dot com)

Thanks,

Ezequiel Jadib

ejadib