【发布时间】:2018-10-22 07:01:04
【问题描述】:
我的应用程序中有一个带有两个选项卡的 TabbedPage,我想使用 NavigateAsync 导航到特定选项卡,但是当我使用 NavigationService.NavigateAsync(“NavigationPage/TabbedPage/SelectedPage”)时,我的应用程序只打开带有 TabbedPage 的 SelectedPage堆栈。我可以点击 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>
这是我在 App 类中的 OnInitialized 方法和 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");
}
【问题讨论】:
标签: xamarin xamarin.forms prism