小编Jos*_*rme的帖子

如何隐藏 shell 中某些页面的后退按钮?

仅在loginnotifications页面上我希望用户无法返回到上一页。在所有其他页面上,该过程可以正常进行。

\n

到目前为止,我只能使用 禁用按钮单击操作BackButtonBehavior IsEnabled = "False"

\n

NotificationsPage.xamlLoginPage.xaml

\n
<Shell.BackButtonBehavior>\n        <BackButtonBehavior IsEnabled="False"/>\n</Shell.BackButtonBehavior>\n
Run Code Online (Sandbox Code Playgroud)\n

后退箭头按钮在导航栏中可见

\n

令牌视图模型

\n
await Shell.Current.GoToAsync($"{nameof(NotificacoesPage)}");\n
Run Code Online (Sandbox Code Playgroud)\n

应用程序.xaml.cs

\n
await Shell.Current.GoToAsync($"{nameof(NotificacoesPage)}", false);\n
Run Code Online (Sandbox Code Playgroud)\n

AppShell.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>\n
Run Code Online (Sandbox Code Playgroud)\n

AppShell.xaml.cs

\n
Routing.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));\n
Run Code Online (Sandbox Code Playgroud)\n

c# xaml android xamarin.forms xamarin.forms.shell

5
推荐指数
1
解决办法
2139
查看次数

标签 统计

android ×1

c# ×1

xamarin.forms ×1

xamarin.forms.shell ×1

xaml ×1