Questions on StockTrader DialogActivationBehavior

Topics: Prism v4 - WPF 4
Feb 18, 2011 at 9:10 PM

1. Why isn’t contentDialog set to null in CloseContentDialog()?

2. Why is CloseContentDialog() being called in ContentDialogClosed(object, EventArgs)?

When deactivating the region it will call ActiveViews_CollectionChanged(object, NotifyCollectionChangedEventArgs) with e.Action equaling Remove.

3. Is it a bug that contentDialog.Close() is being called twice every time you close a dialog window?

I believe that adding null to my question 1 or removing CloseContentDialog() in my question 2 will fix this issue.

Feb 21, 2011 at 7:27 PM


I modify the code as you suggests (remove the this.CloseContentDialog() in the ContentDialogClose event), and the application still works (also unit tests).

However, in my opinion I don´t know exactly the reason why this method is called on the ContentDialogClose event.

As MSDN documentation shows, "(...) is an application that illustrates the baseline architecture (...) When looking at this application, it may seem inappropriate to implement it in the way it was implemented. For example, you might question why there are so many modules, and it may seem overly complex. The focus of Prism is to address challenges around building composite applications. For this reason, certain scenarios are used in the reference implementation to emphasize those challenges."


Miguel Bronzovic