WPF TextBox doesn't take input, space and backspace works

Answer to my own question (if someone else run into the same problem): If you open a WPF-form from a WinForms application you have to do the following to get keyboard input:

MyWpfProject.MainWindow mw = new MyWpfProject.MainWindow();
ElementHost.EnableModelessKeyboardInterop(mw);
mw.Show();

"The EnableModelessKeyboardInterop() call is necessary to handle keyboard input in the WPF window if loaded from a non-WPF host like WinForms." http://weblogs.asp.net/jdanforth/archive/2008/07/29/open-a-wpf-window-from-winforms.aspx


maybe your user control is getting the keyboard event instead of your textbox? try to search in this way, it happens with mouse buttons.

Tags:

C#

Wpf