Button back on Xamarin Cross Plataform

0

How to make a function to when you click "Back" in Android in Xamarin , does the app return to the previous screen?

    
asked by anonymous 14.10.2016 / 14:12

2 answers

1

Speaking about Xamarin.Forms for "Cross Platform Xamarin", you should use OnBackButtonPressed . But remembering how it says in the documentation:

  

The event is generated when the hardware button 'back' is pressed.   This event is not generated on iOS.

Just replace this event in your NavigationPage and you're ready to go:

protected override bool OnBackButtonPressed()
{    
    // A mágica acontece aqui
    return true;
}
    
14.10.2016 / 20:08
1

On any page, you can override this method

    protected override bool OnBackButtonPressed()
    {
        return base.OnBackButtonPressed();
    }
    
14.10.2016 / 20:00