Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger button click event on pressing enter button in c#

I am creating a login form in windows phone app , I want to trigger login button event on pressing enter button from finishing the form.

Requirement: While clicking enter button from last text field in login page should trigger login button event..

Code sample I know how to move from one text field to another on clicking enter button as below

private void passkeydown(object sender, KeyEventArgs e)
{
  if (e.Key == Key.Enter)
 {
  nextfield .Focus();
  }
 }

But I don't know how to trigger button click event here.

like image 745
Vinod Kumar Avatar asked Nov 02 '22 03:11

Vinod Kumar


1 Answers

Try This:

if (e.Key == Key.Enter)
{
  LoginButton_Click(sender,e); //here LoginButton_Click is click eventhandler
}
like image 124
Sudhakar Tillapudi Avatar answered Nov 08 '22 08:11

Sudhakar Tillapudi