TopMost window behavior

Topics: Prism v2 - WPF 3.5
Nov 3, 2009 at 4:23 PM

I'm working with an app that was set up using the Guidance. Mostly it seems to work ok, except that it doesn't always exhibit standard windows behavior. Specifically, we have a few Windows in Regions which appear as popups/dialogs. When made active these popups appear in front of the main region (which lives in the shell) which is what we want.

If the focus is moved from the popup region to the shell region, or any other region for that matter, the region with the focus is not moved to the TopMost position, which is fairly standard in Windows apps. The user has to minimize the popup in order to see the window with the new focus. What the user wants is that the window with the focus comes to the top. Even other windows from other apps do not come to the top.

We are currently using no Region behaviors in the app, and I am guessing that the answer to my problem lies there somewhere. I haven't yet been able to find a solution to this seemingly simple issue however.

Does someone know how to control this focus issue using the Guidance?





Nov 9, 2009 at 7:00 PM

Hi Hedley,

Assuming you are using the Reference Implementation’s RegionPopupBehavior, I have been able to reproduce your issue. The cause of it is that the DialogActivationBehavior sets the popup window’s owner to the Shell window (in the case of the RI). As this site explains, “An owner window can never cover an owned window”. I tried removing that line and was able to get the Shell Window over the popup (this was only for testing purposes, you should check that this does not break anything else).

Please let me know if this helps.

Damian Schenkelman

Nov 9, 2009 at 7:30 PM


In our app we are not explicitly using RegionPopupBehavior, however your explanation makes sense in that case.

Since posting the issue, my QA folks have decided that they actually want to keep the behavior as is for the time being - because this app will be run with 2 monitors.

If that changes again, then I think that your solution will get me pointed in the right direction.