I need to bind a Command for Xamarin forms IOS. I have followed bellow code to bind command to back button. I don't want to use ViewModel.
//this code inside the constructor
Shell.SetBackButtonBehavior(this, new BackButtonBehavior
{
Command = new Command(() =>
{
GoBack();
}),
});
//method for go back
private async Task GoBack()
{
bool result = await Shell.Current.DisplayAlert(
"Going Back?",
"Are you sure you want to go back?",
"Yes, Please!", "Nope!");
if (result)
{
await Shell.Current.GoToAsync("..", true);
}
}
The code perfectly working for Android but not for IOS. Appreciate the quick help and Thanks in advance.
BackButtonBehaviormethod not works in iOS ? docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/… What is the version of Xamarin Forms used in project ? - Junior Jiang