How to publish and subscribe to events

1. add a reference to Prism EventAggregator assemblies
PRISM EventAggregator is used to publish and subscribe to events.
Therefore you have to add a refference to these dll's:

these can be found in trunk\lib\prism

2. create event
Create a new class that presents your event:

all events are classes that derives from CompositePresentationEvent<>
this gives the abillty to find usages of an event very easily
further information can be found here

3. publish event
from the command you have to send your command context to the view:

3.1 in the view you can access and publish all events through context.Events:

4. subscribe to event
in another view you can subscribe to the event like this:


Last edited Mar 9, 2010 at 7:49 PM by troelsrichter, version 10


No comments yet.