-
December 14th, 2010, 03:19 PM
#1
TextBox RaiseEvent KeyDownEvent does not work
Trying to raiseEvent to textBox - but i don't see the key value in the textBox text. I can see that the textbox event "OnKeyDownEvent" is stopping in breakpoints - but i don't understand why the text of the KeyEventArgs ( Key.D0 ) is not insert into the textbox text.
The code:
if( TextBoxInFocus != null )
{
KeyEventArgs k = new KeyEventArgs( Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, System.Environment.ProcessorCount, Key.D0 );
//KeyEventArgs k = new KeyEventArgs( Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.D0 );
k.RoutedEvent = UIElement.KeyDownEvent;
TextBoxInFocus.RaiseEvent( k );
k.RoutedEvent = UIElement.KeyUpEvent;
TextBoxInFocus.RaiseEvent( k );
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|