Strange WPF TextBox Problem
WPF TextBox is not able to respond to some specific keys like Delete, Arrow Keys.
If you are also facing the same problem then here is the simple solution to the problem:
Just enable the Modeless Keyobord on the Window :
Here is the code :
Window w = new Window();
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(w);
w.Show();
or
// Write this code in your window class constructor.
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(this);
** here 'this' refers to the Window class.
Note : if you are not able to find the reference for Integration then add WindowsFormsIntegration reference to your project.
Thanx
If you are also facing the same problem then here is the simple solution to the problem:
Just enable the Modeless Keyobord on the Window :
Here is the code :
Window w = new Window();
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(w);
w.Show();
or
// Write this code in your window class constructor.
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(this);
** here 'this' refers to the Window class.
"ElementHost.EnableModelessKeyboardInterop() essentially registers an input hook with the WinForms Application object (which normally runs the message loop) and calls ComponentDispatcher.RaiseThreadMessage()."
Note : if you are not able to find the reference for Integration then add WindowsFormsIntegration reference to your project.
Thanx
Comments
Post a Comment