PopupChildWindowAction using custom ChildWindow has databinding problems

Topics: Prism v4 - Silverlight 4
Jan 20, 2011 at 5:29 PM


I make use of a custom ChildWindow for use in a popupchildwindowaction : 

<prism:InteractionRequestTrigger SourceObject="{Binding ValidationSummaryInteractionRequest}">



                                            <Views:ValidationSummaryView />    



Now whenever this SummaryView is displayed, the same instance of this childwindow is used, which does not impose a problem an sich.

However, inside this view i have a combobox which is bound (MVVM) to a viewmodel (Confirmation based) which holds a countries observablecollection

Now, the first time I open the SummaryView, databinding between combo and collection works fine. After I close the childwindow, all succeeding calls to the same childwindow have problems binding between the countries combo and countries collection. I believe the problem lies in the single ChildWindow instance that is reused over again, which results resetting the combobox collection ItemsSource... 

How can I force the PCWAction to create a new CW instance on popup??

Any useful ideas would be helpful, thanks!



Jan 20, 2011 at 7:54 PM


One possibility to achieve your desired scenario would be to extend the PopupChildWindowActionBase class to create a new child window each time the Invoke method is called. Another possibility would be to obtain a new instance of your View Model each time the ChildWindow is shown (in the OnOpened method). If you keep experiencing problems after applying one of the aforementioned possibilities, it would be helpful if you could provide us with more information about which kind of problems you're experiencing in the binding, or also a repro sample of your scenario.

I hope you find this helpful.

Guido Leandro Maliandi

Jan 20, 2011 at 8:01 PM

In your view, do you make use of the

    [RegionMemberLifetime ( KeepAlive = false)]


This should force the popup to contain a new instance of the view (this should include your viewmodel) for the popup to show.  Also are you making a change to the underlying collection from within that view before closing and does the collection see that change (at least is it notified)?