Quantcast
Viewing all articles
Browse latest Browse all 1458

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

Hi,

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.

App.xaml.cs:

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

 MainWindow.xaml:

<ribbon:Ribbon DockPanel.Dock="Top"><ribbon:Ribbon.Tabs><ribbon:Tab Label="Tab 1"><ribbon:Group Label="Group"><ribbon:StackPanel><ribbon:PopupButton Label="1. Click here" ImageSourceLarge="{StaticResource MyIcon32}"><StackPanel></StackPanel></ribbon:PopupButton><ribbon:Button Label="2. Then click here" ImageSourceLarge="{StaticResource MyIcon32}"/></ribbon:StackPanel></ribbon:Group></ribbon:Tab></ribbon:Ribbon.Tabs></ribbon:Ribbon><docking:DockSite><docking:Workspace><docking:TabbedMdiHost><docking:TabbedMdiContainer><docking:DocumentWindow Title="MyDocument"><WindowsFormsHost docking:InteropFocusTracking.IsEnabled="True"><WindowsFormsHost.Child><wf:TextBox Multiline="True" WordWrap="True" AcceptsReturn="True"><wf:TextBox.Text>
                                           3. Result: InputManager.Current.IsInMenuMode stays 'true'. WinForms-Controls like this textbox do no longer get any keyboard input.</wf:TextBox.Text></wf:TextBox></WindowsFormsHost.Child></WindowsFormsHost></docking:DocumentWindow></docking:TabbedMdiContainer></docking:TabbedMdiHost></docking:Workspace></docking:DockSite>

 

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

Could you have a look at this? Thank you!

Stefan


Viewing all articles
Browse latest Browse all 1458

Trending Articles