Shell BackButtonBehavior 命令绑定在 UWP 中不起作用

Shell BackButtonBehavior command binding not working in UWP

我是 Xamarin 开发的新手。我尝试使用绑定命令更改后退按钮行为,但这似乎不起作用。这是视图的代码:

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

这是视图模型的代码:

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

当我按下后退按钮时,“GoBackButton”方法没有被调用。我想提一下 Android 作品。

Shell BackButtonBehavior command binding not working in UWP

源自 Xamarin Form 源代码。 BackButtonBehavior 尚未针对 UWP 平台实现,我们可以找到 Android 和 IOS 实现 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.