How to utilise Event aggregator in MEF?

Topics: Prism v4 - WPF 4
Feb 21, 2014 at 7:41 PM
I am running the latest PRISM 4.2. Unfortunately the Event Aggregator tutorial in the documentation is driven via Unity instead of MEF. And I can't get it running under MEF.

If you may be so kind and have a look at my question here on Stackoverflow.

http://stackoverflow.com/questions/21943396/how-to-utilise-event-aggregator-in-mef

Many Thanks for your help,
Houman
Feb 24, 2014 at 7:13 AM
There is a MefEventAggregator which is used by MEF. You have to add the parameter IEventAggregator to your MainViewModel.
[ModuleExport(typeof(MainViewModel))]
public class MainViewModel : BindableBase, IServiceCallback
{
    [ImportingConstructor]
    public MainViewModel(IEventAggregator eventAggregator)
    {            
        eventAggregator.GetEvent<AppExitEvent>().Publish("");
    }
}
I think that's it.