Wpf – cannot write in textbox wpf

textboxwpf

I have a WPF project (creating dll). The text boxes that added, (or the listboxs) will only accept, COPY, PASTE, DELETE, and BACKSPACE.I do not know why the textboxs have this behavior. The system receives all of the events (KEYUP, KEYDOWN, PREVIEWKEYUP, PREVIEWKEYDOWN, but won't change the text if characters are typed.

The TEXTCHANGED event only fires for the Delete, Paste, etc.

The textbox is enable and NOT readonly.

Any help would be appreciated.
thanks, talia.

Best Answer

adding this:

Window window1 = new Window(); 
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(window1); 
window1.Show(); 

should fix the bug.

also add a reference to WindowsFormsIntegration.

thanks everyone!

Related Topic