[英]Xamarin.Forms Navigate from TabbedPage
I am new at Xamarin.Forms, I came from android.我是 Xamarin.Forms 的新手,我来自 android。 I found on Xamarin.Forms Docs that is not recommended to put a TabbedPage in a NavigationPage so what should I do to navigate to another page.
我在 Xamarin.Forms Docs 上发现不建议将TabbedPage放在NavigationPage中,所以我应该怎么做才能导航到另一个页面。 And I don't want to navigate from one of the tabbedPage children, but to navigate from the tabbed page to a whole new page?
而且我不想从 tabbedPage 孩子之一导航,而是从标签页导航到一个全新的页面?
not recommended to put a TabbedPage in a NavigationPage
不建议将 TabbedPage 放在 NavigationPage 中
That means we would better set the MainPage of the App as a TabbedPage directly like这意味着我们最好直接将App的MainPage设置为 TabbedPage
public App()
{
InitializeComponent();
MainPage = new TabbedPage(); // it's better than MainPage = new NavigationPage(new TabbedPage());
}
In Tabbed Pagged we could set the child page of it as NavigationPage like following在 Tabbed Pagged 中,我们可以将其子页面设置为NavigationPage ,如下所示
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:xxx;assembly=xxx"
x:Class="TabbedPageWithNavigationPage.MainPage">
<NavigationPage Title="Page1" IconImageSource="xxx.png">
<x:Arguments>
<local:SchedulePage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Page2" IconImageSource="xxx.png">
<x:Arguments>
<local:SchedulePage />
</x:Arguments>
</NavigationPage>
</TabbedPage>
And in Page1 or Page2 we could navigate to another ContentPage在 Page1 或 Page2 我们可以导航到另一个 ContentPage
await Navigation.PushAsync (new xxxPage ());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.