No Keyboard Input in WindowsFormsHost after Interacting with Ribbon TextBox or ComboBox

Ribbon for WPF Forum

Posted 7 years ago by Nathan Hanson
Version: 17.2.0661
Platform: .NET 4.7
Environment: Windows 10 (64-bit)

Hi, so this is a weird one so hang in there with me. I'm really stumped and not sure what to do.

I have an application with an Actipro WPF Ribbon Window with a ribbon containing a few ribbon text boxes and combo boxes on it. Then in the document area below the ribbon I have a WinForms control that's hosted inside a WindowsFormsHost object. When I interact with the textbox or the combobox on the ribbon by clicking to change the selection or clicking and typing and then I click the WinForms control to change focus back to it, that WinForms control no longer gets any keyboard input.

It's as if the keystrokes are still going to the ribbon controls and I can't find anyway to get keyboard focus to move back to the WinForms control. I have to restart the app to get the ribbon controls to stop eating the keyboard input. We're getting to within days of shipping our app and I'm running out of ideas. Any thoughts you have would be very welcome. I'm also happy to provide a sample app if that helps.

Thanks in advance!


[Modified 7 years ago]

Comments (5)

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

Hi Nate,

I'm sorry you're running into trouble.  I haven't heard of anything like that but WPF/WinForms interop focus can sometimes be wonky.  Can you make a new simple sample project showing this happening so we can debug it and send that over to our support address, referencing this thread?  Please exclude the bin/obj folders from the ZIP and rename the .zip file extension so it doesn't get spam blocked.  Thanks!

Actipro Software Support

Posted 7 years ago by Nathan Hanson

Thanks for the response. As I was building my test app to send in I discovered I'd set 

HwndSource.DefaultAcquireHwndFocusInMenuMode = false;

in my App.xaml.cs. This appears to be what was messing up my keyboard focus for legacy windows in WindowsFormsHost after interacting with the Actipro Ribbon controls. Once I removed that line, keystrokes started flowing again and all is well.

Thanks again for your help and the great components. We're about to ship our brand new, clean. modern UI featuring your Ribbons and Docking and response during beta testing has been very positive. I really appreciate it!

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

Hi Nathan,

Great, I'm glad you sorted it out and thanks for the comments.  Good luck with your app deployment in the next few days!  And feel free to post a link to some screenshots of it.  We love to see what our customers create with our controls.

Actipro Software Support

Posted 6 years ago by Stefan Wrobel


We are currently experiencing the same problem within a similar scenario. (Version is 17.2.0665)

InputManager.IsInMenuMode stays true if I click first in a popup button (or a combobox) within a ribbon and then on an other button within the ribbon.

This only occurs if HwndSource.DefaultAcquireHwndFocusInMenuMode=false, but we need it in combination with Keyboard.DefaultRestoreFocusMode=RestoreFocusMode.None, as explained here. Hence it is not an option for us to set DefaultAcquireHwndFocusInMenuMode to true.


public App() {
    HwndSource.DefaultAcquireHwndFocusInMenuMode = false;
    Keyboard.DefaultRestoreFocusMode = RestoreFocusMode.None;


        <ribbon:Ribbon DockPanel.Dock="Top">
                <ribbon:Tab Label="Tab 1">
                    <ribbon:Group Label="Group">
                            <ribbon:PopupButton Label="1. Click here" ImageSourceLarge="{StaticResource MyIcon32}">
                            <ribbon:Button Label="2. Then click here" ImageSourceLarge="{StaticResource MyIcon32}"/>

                        <docking:DocumentWindow Title="MyDocument">
                            <WindowsFormsHost docking:InteropFocusTracking.IsEnabled="True">
                                    <wf:TextBox Multiline="True" WordWrap="True" AcceptsReturn="True">
                                           3. Result: InputManager.Current.IsInMenuMode stays 'true'. WinForms-Controls like this textbox do no longer get any keyboard input.


I can also provide a complete sample project if that helps.

Could you have a look at this? Thank you!


[Modified 6 years ago]

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

Hi Stefan,

Thanks for letting us know about this scenario.  I believe we were able to track down the problem and have fixed it for the next build 673.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.