仅在login和notifications页面上我希望用户无法返回到上一页。在所有其他页面上,该过程可以正常进行。
到目前为止,我只能使用 禁用按钮单击操作BackButtonBehavior IsEnabled = "False"。
NotificationsPage.xaml和LoginPage.xaml
\n<Shell.BackButtonBehavior>\n <BackButtonBehavior IsEnabled="False"/>\n</Shell.BackButtonBehavior>\nRun Code Online (Sandbox Code Playgroud)\n\n令牌视图模型
\nawait Shell.Current.GoToAsync($"{nameof(NotificacoesPage)}");\nRun Code Online (Sandbox Code Playgroud)\n应用程序.xaml.cs
\nawait Shell.Current.GoToAsync($"{nameof(NotificacoesPage)}", false);\nRun Code Online (Sandbox Code Playgroud)\nAppShell.xaml
\n<TabBar>\n <Tab Icon="notificacao_icone.png"\n Title="Notifica\xc3\xa7\xc3\xb5es">\n <ShellContent ContentTemplate="{DataTemplate local:NotificacoesPage}" />\n </Tab>\n\n <Tab Icon="configuracoes_icone.png"\n Title="Configura\xc3\xa7\xc3\xb5es">\n <ShellContent ContentTemplate="{DataTemplate local:ConfiguracoesPage}" />\n </Tab>\n</TabBar>\nRun Code Online (Sandbox Code Playgroud)\nAppShell.xaml.cs
\nRouting.RegisterRoute(nameof(LoginPage), typeof(LoginPage));\nRouting.RegisterRoute(nameof(TokenPage), typeof(TokenPage));\nRouting.RegisterRoute(nameof(NotificacoesPage), typeof(NotificacoesPage));\nRouting.RegisterRoute(nameof(NotificacaoDetalhePage), typeof(NotificacaoDetalhePage));\nRouting.RegisterRoute(nameof(ConfiguracoesPage), typeof(ConfiguracoesPage));\nRun Code Online (Sandbox Code Playgroud)\n