OnExit event in editText?

Asked

Viewed 191 times

2

I’m looking for an event called onExit in the editText, but I couldn’t find any.

What I want to do is add a function when leaving the field.

Ex 1.: User is using a barcode reader bluetooth and when it reads the code, the reader already passes to another field(with TAB configured in the barcode reader) and already loads the data related to that code.

Ex 2.: When adding the zip code when the user selects another field the system already automatically loads others without pressing any button.

Ex. In code: Change the "translateButton" button to editText and the "Click" event to what I didn’t find is "onExit".

translateButton.Click += (object sender, EventArgs e) => 
{
    Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);   // Translate user's alphanumeric phone number to numeric translatedNumber =
    if (String.IsNullOrWhiteSpace(translatedNumber)) 
        { 
            callButton.Text = "Call"; callButton.Enabled = false; 
        } 
    else 
        { 
            callButton.Text = "Call " + translatedNumber; callButton.Enabled = true; 
        } 
};

If anyone knows anything like that, please help me.

2 answers

0

In Xamarin Forms Entry has an event called Unfocused so Voce can implement the function field. Unfocused += (Object Sender, Focuseventargs e) =>{ //implement } If you have for Xamarin Forms, surely you have for Android.

0

I would use the Android attribute itself, the FocusChangeListener. In Xamarin, you can put something like this:

translateButton.FocusChange += (sender, e) => {
  if ( e.HasFocus ) {
    //ganhou foco
  }
  else {
    //perdou o foco
  }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.