Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Event aggregator - why is subscriber event only firing once?

$
0
0
Hi Gabriel, thanks for the reply. I'm publishing and subscribing in the standard way, like this:-
        eventAggregator.GetEvent<CompositePresentationEvent<MyEvent>>().Publish(new MyEvent());

        eventAggregator.GetEvent<CompositePresentationEvent<MyEvent>>().Subscribe(MyEventHandler);
(where "MyEvent" is a POCO class that may or may not contain additional information about the event). I've never had to use any filter predicates when subscribing.

I've been using the EventAggregator fine in another project, but I am doing something a little different with this particular view/view-model (the VM subscribes to the event in its ctr). After the view (and in turn the view-model) are resolved by my IoC container, the view is then added to the "Children" collection of a FrameworkElement control that lives in my main window (rather than being, typically, added to a Region like my other views). I can only assume that this is somehow causing the problem - perhaps something is "losing" a reference to the view/view-model once it has been created?

Viewing all articles
Browse latest Browse all 1878


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>