Xamarin.forms 表单:如何导航到TabbedPage';s子页面
我遇到了在Xamarin.Forms中从MyTabbedPage/ChildTabbage1/Page1导航到MyTabbedPage/ChildTabbage2/Page2的场景 现在,我只能在MyTabbedPage/ChildTabPage1和MyTabbedPage/ChildTabPage2之间切换。但我需要直接从MyTabbedPage/ChildTabPage1/Page1导航到MyTabbedPage/ChildTabPage2/Page2 如何做到这一点?Xamarin.forms 表单:如何导航到TabbedPage';s子页面,xamarin.forms,tabbedpage,Xamarin.forms,Tabbedpage,我遇到了在Xamarin.Forms中从MyTabbedPage/ChildTabbage1/Page1导航到MyTabbedPage/ChildTabbage2/Page2的场景 现在,我只能在MyTabbedPage/ChildTabPage1和MyTabbedPage/ChildTabPage2之间切换。但我需要直接从MyTabbedPage/ChildTabPage1/Page1导航到MyTabbedPage/ChildTabPage2/Page2 如何做到这一点? 非常感谢您的帮助。您
非常感谢您的帮助。您可以试试这样的东西
public App()
{
InitializeComponent();
var parentPage = new MasterDetailView(); // name of the master detail page
parentPage.IsPresented = false;
var tabbedPage = new MasterDetailTabbedPage(); // name of the tabbed page
tabbedPage.CurrentPage = tabbedPage.Children[2]; // specify the index of the tab
parentPage.Detail = new NavigationPage(tabbedPage); // assign the tabbed page to master detail page
MainPage = parentPage; // navigate to master detail page (3rd tab selected)
}
如果您想在Xamarin中将MyTabEdabdEng/PoaTabpAGE1/PG1导航到MyTabeBestPo/HealTabPaGe2/PaGe2。窗体,我建议您可以考虑使用<强> shell < /强>这样做。
Xamarin.Forms Shell包括基于URI的导航体验,使用路由导航到应用程序中的任何页面,而不必遵循设置的导航层次结构。此外,它还提供了向后导航的能力,而无需访问导航堆栈上的所有页面下面是关于使用Shell的文章:您的解决方案似乎只从MyTabbedPage/ChildTabbage1导航到MyTabbedPage/ChildTabbage2var mainTabbedPage=new mainTabbedPage();mainTabbedPage.CurrentPage=mainTabbedPage.Children[1];mainTabbedPage.CurrentPage.Navigation.PushAsync(新的Page2());主页=新导航页(主页);你可以试试这个,它在功能上起作用。但在导航过程中会查看mainTabbedPage.Children[1]。如何进行清晰的导航?为此,我需要检查Xamarin.FormsShell仍处于实验阶段,但它提供的功能非常有用。我一定会尝试它一旦在稳定阶段