Floating toolwindow and ActiveWindow issues

Docking/MDI for WPF Forum

Posted 7 years ago by Chien A.
Version: 17.2.0660
Platform: .NET 4.6
Environment: Windows 10 (64-bit)
Avatar

Hi, a few things we've noticed with floating toolwindows and changing of DockSite.ActiveWindow

1) Right-clicking on a floating toolwindow titlebar, the context menu sometimes seems to open at 0,0 (top-left-most monitor point). Reopening the contextmenu repeatedly at different points and left-clicking to close it in between opening is the most reliable way to reproduce this.

2) Unlike UIStudio docking, floating toolwindows lose active state when interacting with a main menu on the main window hosting the docksite. This means main menus and toolbars can't be used with floating toolwindows (and unlike VS 2015 - e.g. the Window menu to change state etc of the active toolwindow).

Curiously, if you right-click the titlebar to open the contextmenu, then click on mainmenu/toolbar, the floating window does retain Active status...

3) DockingWindow.IsVisibleChanged happens after DockSite.OnWindowActivated/WindowActivated. In WinForms UIStudio it was the opposite, which makes more sense. Previously we were using the change in visibility to perform certain actions necessary before the Window becomes focused/active, atm we are attempting to workaround this by checking in OnWindowActivated whether DockWindow.IsVisible = false, which is a bit weird : ).

[Modified 7 years ago]

Comments (1)

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

Hi Chien,

1) Thanks for reporting this.  It appears to be due to some conflict between the non-client title bar area wanting a context menu and us supplying our own in that scenario.  I believe we found a workaround for the problem and that will be in the next build.

2) Yes, that was because when we built our own menu system in WinForms we were able to block mouse clicks from activating the containing Form.  In WinForms some of that is easier too since each control has its own Windows handle.  That sort of thing is tougher in WPF and would need to be done more at an app level.  

This thread talks about the issue and roughly describes some things you can do.  Microsoft added APIs into WPF to help a bit when they built Visual Studio in WPF:

https://stackoverflow.com/questions/6410146/dockable-windows-floating-window-and-mainwindow-menu-integration

3) We don't control the IsVisible property, that is something that core WPF updates.  I would suggest you instead handle the DockSite.WindowsOpening event since that occurs before a docking window is about to enter the layout.  WindowActivated on the other hand can occur any time the window gains focus, so it is not a good choice for your needs there.


Actipro Software Support

The latest build of this product (v24.1.3) was released 29 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.