Stay On Top Window using Prism Regions

Topics: Prism v4 - WPF 4
Jul 18, 2011 at 5:31 PM

Hello!

I'm using Prism 4 in my application and I want to display a "Stay on Top" windows like.

I can see that Regions have an Activate method to bring the window but not a TopMost property (such as normal Window WPF)

After all the wiring this is my function that displays a new window/usercontrol

 

public void OpenView(IRegionManager regionManager, IUnityContainer container, string regionName, string viewName, Type interfaceType)
{
  var region = regionManager.Regions[regionName];
  var view = region.GetView(viewName);

  if (view == null)
  {
     view = container.Resolve(interfaceType);
     region.Add(view, viewName);
  }

  region.Activate(view);
}

Someone already have faced a similar problem?

Have a nice day!

Developer
Jul 19, 2011 at 2:52 PM
Edited Jul 19, 2011 at 5:00 PM

Hi,

Thank you for sharing this concern with the rest of the community. Please take into account that Regions do act as wrappers for the control that hosts them in terms of adding views to it, but they are not intended to expose other functionality of the control behind them.

Therefore, you could manually edit the hosting control's TopMost property via a custom service of your own, or you could add a custom logic to your region via a region behavior. You might find the IHostAwareRegionBehavior region behavior useful to this purpose.

If you think this should be included in Prism out of the box, you could create a work item in the Issue Tracker, for the product team to consider this for future versions.

Thanks,

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi