开发者

cannot write in textbox wpf

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 TEXT开发者_JAVA技巧CHANGED event only fires for the Delete, Paste, etc.

The textbox is enable and NOT readonly.

Any help would be appreciated. thanks, talia.


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!


I had this same problem and then realised that I had handled the KeyDown event on the parent Window (and also set e.Handled to true). This in effect prevented any child controls from seeing KeyDown events.


I have had this situation before, my only solution was to create a new solution / project and copy the code across.

Quite weird!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜