如何在没有后退按钮的情况下在 Xamarin Shell 中切换页面?
How to switch pages in the Xamarin Shell without a back button?
我想在Shell类APP的顶部做一个home键。
(指 Xanimals 应用程序。)
此主页按钮的用途是移动到 Shell 中的特定常规页面之一。
gotoasync() 函数默认将上一页添加到导航堆栈,并启用后退按钮。
我不想要后退按钮,我只想像按下 Shell 结构中的弹出按钮那样移动。
请帮帮我。
试试下面的方法:
在您的主页按钮点击事件中:
Shell.Current.CurrentItem.CurrentItem.Items.Add(Your new Page);
Shell.Current.CurrentItem.CurrentItem.Items.RemoveAt(0);
您可以尝试这种切换到不同导航堆栈的方法;假设主页视图在您的 AppShell.xaml
中注册了路由名称 home
await Shell.Current.GoToAsync("//home");
以下是所有路由格式的参考:
我想在Shell类APP的顶部做一个home键。 (指 Xanimals 应用程序。)
此主页按钮的用途是移动到 Shell 中的特定常规页面之一。
gotoasync() 函数默认将上一页添加到导航堆栈,并启用后退按钮。 我不想要后退按钮,我只想像按下 Shell 结构中的弹出按钮那样移动。
请帮帮我。
试试下面的方法:
在您的主页按钮点击事件中:
Shell.Current.CurrentItem.CurrentItem.Items.Add(Your new Page);
Shell.Current.CurrentItem.CurrentItem.Items.RemoveAt(0);
您可以尝试这种切换到不同导航堆栈的方法;假设主页视图在您的 AppShell.xaml
中注册了路由名称home
await Shell.Current.GoToAsync("//home");
以下是所有路由格式的参考: