How to Simply Implement the Hierarchical EventAggregator

Sometimes the Prism Application may need the hierarchical event aggregator. In this post, I want to share my implementation of HierarchicEventAggregator.


1. To create the instances, do the following:
IHierarchicEventAggregator root = new HierarchicEventAggregator();
IHierarchicEventAggregator workspace1 = root.CreateChildHierarchicEventAggregator();
IHierarchicEventAggregator workspace2 = root.CreateChildHierarchicEventAggregator();

2. To publish the event locally, do the following:
workspace2.PublishToLocalSubscribers<TabClosedEvent, TabClosedEventArgs>(new TabClosedEventArgs() { });

3. To publish the event for each hierarchic level, do the following:
workspace1.PublishToAllSubscribers<TabClosedEvent, TabClosedEventArgs>(new TabClosedEventArgs() { });

I hope this has been useful to you!

Looking for quality Silverlight Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , | Posted under 3rd Party Software, Programming/Coding | RSS 2.0

Leave a Reply

Your email address will not be published. Required fields are marked *