Loss of Focus on Entry in Xamarin

0

I'm building a mobile application with Xamarin Forms and C # where I need to do the CPF check and validate the email. I'm wanting to do the validations as soon as the field loses focus. I'm using MVVM in my application.

Can anyone help me solve the problem?

    
asked by anonymous 03.05.2018 / 18:06

1 answer

0

As WictorChaves said, your question is too broad. But broadly speaking, you can also manage the Unfocused event of the Entry component.

See an example:

Declaring via XAML

<Entry Text={Binding CampoTexto} Unfocused="Entry_Unfocused"/>

Or declaring via C #

Entry entry = new Entry();
entry.SetBinding(Entry.TextProperty, new Binding("CampoTexto"));
entry.Unfocused += Entry_Unfocused;

And the event handler implementation would look like this:

private void Entry_Unfocused(object sender, FocusEventArgs e)
{
    // Seu tratamento seria feito aqui
}

I hope I have helped.

    
03.05.2018 / 18:23