Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot write in textbox wpf

Tags:

wpf

textbox

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.

like image 846
talia Avatar asked Dec 12 '22 20:12

talia


1 Answers

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!

like image 122
talia Avatar answered Dec 16 '22 17:12

talia