tags:

views:

89

answers:

2

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.

A: 

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

Quite weird!

benPearce
I did try to do as you said, and and it did not help.still I have no idea what to do...
talia
and if you create a new solution and empty project, do you still get the same?
benPearce
I opened a new wpf Application and then its ok. but my project is wpf user control Lib. i should creat a dll. anyway creat a new solution and copy everyhing because have lots of projects in it.is there another way? thanks
talia
This might be a long shot, try installing / reinstalling .net 3.5 sp1 - http://social.msdn.microsoft.com/forums/en-US/wpf/thread/194a28a9-a5f9-4bd7-b2b2-a84496197d17/
benPearce
I had .net 3.5 sp1 installed. I uninstalled and reinstalled it. It did not help.
talia
A: 

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!

talia
You did not mention WinForms intergration was involved!
benPearce
there is no integration with WinForms... this is wpf project. although in the solution there are other WinForms projects...
talia