Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to call PreviewLostKeyboardFocus event in Keydown event of Wpf application.How to do this?
I googled it but could not find solution.
Posted
Comments
[no name] 23-Aug-13 9:26am    
Wanting to "call" an event handler is a bit unusual. Can you clarify what it is that you mean? You *could* simply call the event handler just like any other method call passing null or Nothing as the parameters.
Rachna0309 23-Aug-13 9:31am    
I have code in keydown event as:
If e.key = key.enter or e.key = key.tab Then
textbox1.focus()
End If

And in PreviewLostKeyboardFocus I retrive values for other textboxes. If I press Tab key it works fine but if I press Enter key,previewlostkeyboardfocus event is not called.
[no name] 23-Aug-13 10:06am    
That is because the Enter key does not cause the textbox to lose or change focus.
Rachna0309 23-Aug-13 10:08am    
Then is there any other option by which I can use Enter key to loose focus?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900