'Xamarin Software Back Button Event

How can I fire an event when the software back button in the navigation bar is tapped?

I tried using the following code but this only works for a hardware back button.

protected override bool OnBackButtonPressed()
{
     return true;
}


Solution 1:[1]

The OnBackButtonPressed is fired when you press the back button on the device. If you want to get backbutton event. You may need to create Custom Renderers for each platform. You can refer to the answer here Override nav bar back button click on Xamarin.Forms

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Peppers