Search code examples
wpfprism-2cal

WPF Prism (CAL) - Find all Subscriptions to the EventAggregator on any event


Is there any way of looking at all the subscriptions contained within the EventAggregator for all Events?

Theres only a .GetEvent method off the EventAggregator ... but I'd just like to see all subscriptions that are contained within it ... without having to go each Event in turn.

Thanks


Solution

  • The out-of-the-box implementation does not provide a means for you to obtain all events. Therefore, if you want this you'll need to either:

    • resort to nasty reflection to pull the dictionary of events out of your EventAggregator
    • supplement the IEventAggregator with another property that yields all events. You can't use inheritance to add this because the dictionary of events is declared private, not protected