我的应用程序中有一个带有两个选项卡的TabbedPage,我想使用NavigateAsync导航到一个特定的选项卡,但当我使用NavigationService.NavigateAsync(" NavigationPage / TabbedPage / SelectedPage")时,我的应用程序打开只有SelectedPage与堆栈中的TabbedPage。我可以单击SelectedPage中的后退按钮返回TabbedPage。
有没有人知道出了什么问题?
这是我的TabbedPage axml:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="correct namespace was hide"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="correct namespace was hide">
<TabbedPage.Children>
<local:Pacientes/>
<local:Sobre/>
</TabbedPage.Children>
</TabbedPage>
这是我的OnInitialized方法和App类中的RegisterTypes:
protected override async void OnInitialized()
{
InitializeComponent();
if (Device.RuntimePlatform.Equals(Device.Android))
{
await NavigationService.NavigateAsync("Android.Main/OdontoWayPacienteNavigation/Sobre");
}
else
{
await NavigationService.NavigateAsync("/NavigationPage/iOS.Main/Sobre");
}
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<OdontoWayPacienteNavigation>();
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<Pacientes>();
containerRegistry.RegisterForNavigation<Clinicas>();
containerRegistry.RegisterForNavigation<PacienteEdit>();
containerRegistry.RegisterForNavigation<ClinicaMap>();
containerRegistry.RegisterForNavigation<LinkWeb>();
containerRegistry.RegisterForNavigation<Sobre>();
containerRegistry.RegisterForNavigation<Views.Android.PacienteAcessos, PacienteAcessosViewModel>("Android.PacienteAcessos");
containerRegistry.RegisterForNavigation<Views.iOS.PacienteAcessos, PacienteAcessosViewModel>("iOS.PacienteAcessos");
containerRegistry.RegisterForNavigation<Views.Android.Main, MainViewModel>("Android.Main");
containerRegistry.RegisterForNavigation<Views.iOS.Main>("iOS.Main");
}
答案 0 :(得分:0)
该解决方案已发布在此链接https://forums.xamarin.com/discussion/comment/330770#Comment_330770
导航的行为在棱镜版本7中发生了变化。打开特定选项卡的新行为是
NavigateAsync("TabbedPage?selectedTab=PageName")