Popup Region Adapter

Topics: Prism v2 - Silverlight 2
Jul 29, 2009 at 4:49 PM

I'm using Prism 2 with Silverlight 2. I've looked at the Popup region adapter logic in the StockTrader application (RegionPopupBehaviors.cs and associated logic) and have used the same logic in my application. It means I can assign a region to a popup and load a view into that region and is working well except if I put any listboxes in the content within the popup and then click on them I get the following error : System.Exception: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)). Looking on the net it seems it might be related to the registering of the popup with the visual tree. I've set the popup region in my shell.xaml and am referencing that region from other modules successfully but crashes with listboxes. Just wondering if anyone had any ideas. I'm going to look into more to see if I can see what it might be.

This is the reference code in my shell.xaml (I'm using the same namespace for now as the StockTrader application)

xmlns:infBehaviors="clr-namespace:StockTraderRI.Infrastructure.Behaviors;assembly=ShopPortal.Infrastructure"

infBehaviors:RegionPopupBehaviors.CreatePopupRegionWithName="PopupRegion" <font size="2">

 

</font>

infBehaviors:RegionPopupBehaviors.ContainerWindowStyle="{StaticResource PopupStyle}"

Thanks

Gavin

 

Jul 29, 2009 at 5:34 PM

Hi Gavin,

The following article explains the cause of this issue and provides a workaround for it:

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Jul 29, 2009 at 6:59 PM

Hi Damian

Thanks for getting back so quickly. Yes that fixed it and all working. I could see after a bit more research after writing the post that I needed to add the popup to the visual tree but couldn't see a clean way of doing it within the Popup Region adapter. This code you've shown me does the job.

Many Thanks

Gavin