How to get Enter key event in windows phone 8.1

Rahul Kiwitech
Rahul K...
292 Points
26 Posts

I am new in Window phone development. I trying to catch enter key event as

<TextBox x:Name="txtMessage" KeyDown="txtMessage_Enter"/>

but not working

private void txtMessage_Enter(object sender, KeyRoutedEventArgs e) {
//always fired
}

how to find the specific enter key?

Views: 9763
Total Answered: 1
Total Marked As Answer: 0
Posted On: 11-Jun-2016 21:59

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
1390 Points
18 Posts
         

You are doing right. Just put the key filter into the event as

private void txtMessage_Enter(object sender, KeyRoutedEventArgs e) {
if (e.Key == Windows.System.VirtualKey.Enter) {
// do anything here
}
}

 

Posted On: 11-Jun-2016 22:03
 Log In to Chat