I need to capture when the Page_SizeChanged event fires in a WPF Browser application and publish the event through the Prism EventAggregator. Since the page I am interested in happens to be the Shell page, I don't have a ViewModel attached where I can access the eventaggregator.
+1
A:
In your bootstrapper (i.e. UnityBootstrapper derived class) where you initialize your shell, IEventAggragator is registered with the Unity container during the call to the base class ConfigureContainer method. Therefore if you override ConfigureContainer, you can resolve the event aggregator:
protected override void ConfigureContainer()
{
base.ConfigureContainer();
IEventAggregator eventService = Container.Resolve<IEventAggregator>();
}
At this point you could set a property on your shell\viewmodel with the event aggregator instance, or use a service locator type pattern for example. That's up to you.
chibacity
2010-07-26 22:26:27
This is just what I needed. I didn't realize you could resolve out the EventAggregator. Thank you!
Blake Blackwell
2010-07-27 13:33:43