
OK thanks for the interesting article!!
I tried this:
static App()
{
HwndSource.DefaultAcquireHwndFocusInMenuMode = false;
Keyboard.DefaultRestoreFocusMode = RestoreFocusMode.None;
}
And I was happy to see that my DocumentWindow was still active when I clicked on a button of the ribbon, but...
.. a lot of weird bugs happens, but it seems to come from the Ribbon control.
So I created a Sample with a menu and 2 controls: 1 TextBox in WPF and 1 in WinForms in a WindowsFormsHost.
And I display the state of the InputManager.Current.IsInMenuMode property.
When I click on a menu, the IsInMenuMode is set to true, and when the command is executed the IsMenuMode is set back to false and everything is OK, the focus is not stolen by my menu, the command is executed and the focus is still in the TextBox (WPF and WinForms) => GREAT.
Then I changed my menu with a Ribbon, I don't know if it is the reason of the bug but the IsMenuMode seems to be stuck to true.
I think I should ask this in the Ribbon forum, no ?