C# 如何对shell中的某些页面隐藏“后退”按钮?

C# 如何对shell中的某些页面隐藏“后退”按钮?,c#,android,xaml,xamarin.forms,xamarin.forms.shell,C#,Android,Xaml,Xamarin.forms,Xamarin.forms.shell,仅在登录和通知页面上,我希望用户不能返回上一页。在所有其他页面上,该过程可以正常进行 到目前为止,我只能使用BackButtonBehavior IsEnabled=“False”禁用按钮单击操作 通知spage.xaml和登录页面.xaml TokenViewModel wait Shell.Current.GoToAsync($“{nameof(notificacospage)}”); App.xaml.cs wait Shell.Current.GoToAsync($“{nameo

仅在
登录
通知
页面上,我希望用户不能返回上一页。在所有其他页面上,该过程可以正常进行

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

通知spage.xaml登录页面.xaml


TokenViewModel

wait Shell.Current.GoToAsync($“{nameof(notificacospage)}”);
App.xaml.cs

wait Shell.Current.GoToAsync($“{nameof(notificacospage)}”,false);
AppShell.xaml


AppShell.xaml.cs

Routing.RegisterRoute(name of(LoginPage),typeof(LoginPage));
RegisterRoute(nameof(TokenPage),typeof(TokenPage));
RegisterRoute(名称(notificacospage),类型(notificacospage));
Routing.RegisterRoute(名称(notificacodetalhepage),类型(notificacodetalhepage));
Routing.RegisterRoute(名称(配置空间)、类型(配置空间));

这里有一个解决方法。您可以隐藏整个导航栏,然后使用StackLayout自定义导航栏来代替它

比如:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="ShellNewDemo.Views.ItemDetailPage"
         Shell.NavBarIsVisible="False"   //hide the navigationbar
         >

  <ContentPage.Content>

      <StackLayout Orientation="Vertical">

        <StackLayout Orientation="Horizontal">

            //define your custom navigationbar

        </StackLayout>
        <StackLayout Orientation="Vertical">

           //content

        </StackLayout>

      </StackLayout>
    
  </ContentPage.Content>

</ContentPage>

//定义自定义导航栏
//内容

在用户填写
登录
字段并填写
令牌
字段后,他将被引导到
通知
页面(打印页面上的页面)。通过下方菜单,他可以访问
设置
页面,在该页面他可以删除他的帐户(这将使他进入
登录
页面,再次填写字段)。使用GotoAsyncW两者都适合您吗?这是一个已知的应用程序,已移动到。我将无法使用模式导航,因为我需要在
Shell.TitleView中显示应用程序的徽标。