Floating DocumentWindow does not maintain context when clicking Main Window's menu bar

Docking/MDI for WPF Forum

Posted 11 years ago by Jim Strav
Version: 11.2.0554
Avatar

I handle the DockSite.WindowActivated event to change my main window's Edit menu options depending on which DocumentWindow is active.  The problem is, when you have a floating DocumentWindow and click the menu in the main window, it activates the currently DocumentWindow that is docked in the main window.  This makes it impossible to access the Edit menu for a floating DocumentWindow.

If you do this in VisualStudio 2010, you'll see the behavior I need.  When clicking the main window's menu bar, the floating DocumentWindow maintains the active state.

Any workarounds or is this fixed in a newer version than the one I have?

Comments (2)

Posted 11 years ago by Jim Strav
Avatar

I found my own answer here:

http://blogs.msdn.com/b/visualstudio/archive/2010/03/09/wpf-in-visual-studio-2010-part-3-focus-and-activation.aspx;

The relevant code is:

// By default, WPF menus will acquire Win32 focus for the HwndSource in which they are contained.

// This flag prevents WPF menus from acquiring Win32 focus when they receive WPF focus.
HwndSource.DefaultAcquireHwndFocusInMenuMode = false;

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

Hi Jim,

As you saw, this is a bit out of our control since in WPF, clicking on a window's content will activate the window.  There is also this post in StackOverflow that shows a workaround that can be used with WPF docking window products like ours:

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

I hope that helps!


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.