Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to get Navigation back button event in Xamarin forms

$
0
0

In my project on one page there is a form to add products.
if user doesn't save the details and pressed back button, at that time I want to display the action sheet having Discard, Save, Cancel options.
I'm unable to get the back button pressed event.
I'm working in Xamarin studio and used cross platform with xamarin form

I've already tried OnBackButtonPressed event but it doesn't get call

protected override bool OnBackButtonPressed()
{

Device.BeginInvokeOnMainThread(async() => {
    var result = await DisplayActionSheet("Action","Cancel",null,"Discard","Save");
        //if (result) await this.Navigation.PopAsync(); // or anything else
    });

return base.OnBackButtonPressed();

}


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>