xamarinxamarin.formsuwpxamarin.uwpxamarin.shell

Shell BackButtonBehavior command binding not working in UWP


I am kind of new to Xamarin development. I tried to change the back button behavior with a binding command, but that didn't seem to work. This is the code for the view:

<Shell.BackButtonBehavior>
    <BackButtonBehavior Command="{Binding GoBack}"/>
</Shell.BackButtonBehavior>

And this is the code for the view model:

public CreatePasswordVM()
{
    _goBack = new Command(GoBackButton);
}
private ICommand _goBack;
public ICommand GoBack
{
    get { return _goBack; }
}
public async void GoBackButton()
{
    await Shell.Current.GoToAsync("../..");
}

When I pressed the back button, the method "GoBackButton" didn't call. I want to mention that on Android works.


Solution

  • Shell BackButtonBehavior command binding not working in UWP

    Derive from Xamarin Form source code. BackButtonBehavior has not implemented for UWP platform, we could find Android and IOS implementation here and here. But for uwp there is not such tracker and there is not such value in the UWP ShellRenderer. For this scenario, we suggest your post new feature request in the Xamarin Forms github.