Extracted from the Caliburn Micro documentation on EventAggregator:
// Creating the EventAggregator as a singleton.
public class Bootstrapper : BootstrapperBase {
private readonly SimpleContainer _container =
new SimpleContainer();
// ... Other Bootstrapper Config
protected override void Configure(){
_container.Singleton<IEventAggregator, EventAggregator>();
}
// ... Other Bootstrapper Config
}
// Acquiring the EventAggregator in a viewModel.
public class FooViewModel {
private readonly IEventAggregator _eventAggregator;
public FooViewModel(IEventAggregator eventAggregator) {
_eventAggregator = eventAggregator;
}
}
So the question is how do you get the instance of EA created by Bootstrapper to inject into your VM?
var svm = new SomeViewModel(?);
I tried using Caliburn.Micro.IoC.Get method but that didn't work...