Oct 21, 2008 at 1:55 PM
Edited Oct 21, 2008 at 6:02 PM
The EventAggregator provides you a service for publishing and subscribing to events without the need of instantiating and registering events. It is primarily a container for events
(it keeps a collection of the events in the system), but relieves the publisher or subscriber from needing to determine whether the event is available. Moreover, it is responsible for locating or building events (the EventAggregator will construct the event
on its first access if it has not already been constructed). So, the event will be built upon subscription or publication, allowing the publisher to fire the event without knowing if the event has been created or if there are any subscribers attached, and
allowing the subscriber to attach a handler to the event without knowing if the event has already been created.
Regarding the described problem, if the views contained in a document need to get the events that only its parent document publishes, you may provide a filter to generate that scope. For
true, somePayload => IsInContext(somePayload));
//TODO: Add the logic to determinate if the event should be executed in the current context (e.g.: if the View is in the document).
void OnSomeEvent(SomePayload something)
//TODO: Add the logic to handle the event.
In addition, the team considered that kind of scoping you are mentioning, but, as it was not a main scenario (regarding users’ feedback), it was not implemented to keep simplicity.
For more information on the EventAggregator, you may have a look at this topic of the help:
Hope it helps.
Ignacio Baumann Fonay