Popup WPF RequestNavigate

Topics: Prism v4 - WPF 4
Jul 10, 2012 at 10:48 AM

I'm using RequestNavigate/Region through all my application. It works good and well for main window and dialog windows. But now I'm stuck trying to navigate to region inside simple WPF Popup control. As far as I understood RegionManager.Regions isn't populating with my region created inside Popup. I set region with:

RegionManager.SetRegionName(content, Common.RegionNames.PopupFilter);

Probably somewhere inside Prism engine, it tries to find parent Window object and fails because Popup doesn't belong to any window

Please advice

Jul 10, 2012 at 1:51 PM
Edited Jul 10, 2012 at 1:57 PM


Based on my understanding if your are simple showing a new popup window, and defining regions within it. You will have to manually set the RegionManager for this new window. For example like this:

RegionManager.SetRegionManager(popupWindow, this.Container.Resolve<IRegionManager>());

An example of this can also be seen in the following blog post and related work item:

Also, in my case I have used the WindowDialogActivationBehavior included with the Stock Trader RI, which allows you to define a region that, when a view is added to it, will be shown in a new window/popup. With this approach you should also be able to see regions defined inside your popups.

For more information on this topic, you could take a look at the following code files (in the WPF version of the RI):

  • StockTraderRI_Desktop\StockTraderRI.Infrastructure\Behaviors\RegionPopupBehavior.cs
  • StockTraderRI_Desktop\StockTraderRI.Infrastructure\Behaviors\WindowsDialogActivationBehavior.cs

I hope you find this handy,

Agustin Adami

Jul 10, 2012 at 2:06 PM

Wow, that was really simple

Thank you