Recurring Problem: Non-Existent Views

Topics: Prism v2 - WPF 3.5
Aug 4, 2010 at 7:09 PM

Hello All,

I have repeatedly run into the following situation: In a view, I write code to register that view for an event, but at runtime, the event does not get handled because the view does not yet exist (because the user hasn't done anything to cause it to be displayed yet).

Is there a standard solution to this problem? Or, is this problem *always* indicative of a flawed design?



Aug 5, 2010 at 3:04 PM

Look in the Prism docs for the Event Aggregator.  It allows you to publish and/or subscribe to events and handles the hook-up between the publishers and subscribers.  There is also an event aggregation quickstart in the code base showing the idea by itself.

If that does not get you started, let me know,
Michael Puleio

Aug 5, 2010 at 4:16 PM

Thank you for your response. I am well-familiar with EventAggregator and have already published and subscribed to all events as needed. The question posed in my original post is more a view question than an event question.