Reputation: 15
Can someone redirect me or show me one example about how do I bind my button click of xaml to enter key on keyboard in windows phone?
Upvotes: 1
Views: 583
Reputation: 65586
You can't do this directly with binding. You'll have to interrogate the specified key in code and then trigger the same action that you fire on button click.
XAML:
<TextBox KeyUp="CheckForEnterPressed" />
CS:
private void CheckForEnterPressed(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
// Do something appropriate here
}
}
If you don't want to have this code in the page you could encapsulate it into a control.
Upvotes: 2