ToolWindow opens in background

Docking/MDI for WPF Forum

Posted 11 years ago by Gian Luca Lavelli
Version: 12.1.0561
Avatar

Hello,

I am having a problem with this situation:

I can open a ToolWindow (B) from another ToolWindow (A) based on some events (per customer request, B's starting Location is the mouse current position)

  • If I open B while A is docked to the application's only DockSite, everything works perfectly;
  • if I open B while A is undocked and floating, B is opened behind A.

Is there any way to force B to move in the foreground?

Thanks,

Comments (5)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gian,

Do you open it via ToolWindow.Activate(true)?


Actipro Software Support

Posted 11 years ago by Gian Luca Lavelli
Avatar

I am doing the following

private ToolWindow AddFloating(string inCaption, UserControl inUIControl)
{
  ToolWindow tw = new ToolWindow(content.DockSite)
  {
    Content = inUIControl,
    Title = inCaption,
    Focusable = true
  };

  DockSite.SetControlSizeForState(tw, inUIControl.RenderSize, DockingWindowState.Docked);
  tw.Float(WPFUtilities.Utilities.GetScreenMousePosition(), new Size(420, 400));
  tw.Activate(true);

  return tw;
}

I added tw.Activate(true) after your suggestion but it didn't change the behavior

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gian,

I did a quick test here with creating a new tool window effectively with the same code you have in response to a button click on another floating tool window.  When I tested it the new one was on top like you wanted.  So perhaps whatever control you are clicking in your app to create the new tool window is retaining the focus somehow?  Try executing that code from a regular Button and see if it still happens.


Actipro Software Support

Posted 11 years ago by Gian Luca Lavelli
Avatar

Thanks for the help, but still it opens in the background.. I am starting to think that it is a side effect of the way I send events around my application. Maybe it would be easier to get a reference to the floating window's outermost container (I think it's a Window or Form or similar?) and call something like a BringToFront?

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gian,

I was going to say perhaps it's something in your app that is causing it.  You can probably get the Window via Window.GetWindow(tw).  And then call the Activate() method on it to bring it to the front.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.