Issue
I have a problem. In my app I have the following structure
- NavigationPage (root)
- TabbedPage
- NavigationPages
- TabbedPage
Now I want to go from a page inside the TabbedPage
to another page with Navigation.PushAsync()
, but when I do that, I get the new page on screen with the TabbedPageBar
. That is not what I want, I want to use the root NavigationPage
to go to another page, so when click back I come back at the NavigationPage
inside the TabbedPage
.
Here is some code:
App.xaml.cs:
MainPage = new NavigationPage (new MainPage());
MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:MyApp.Views"
mc:Ignorable="d"
x:Class="MyApp.Views.MainPage"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.ToolbarPlacement="Bottom"
BarBackgroundColor="White"
BarTextColor="Black"
android:TabbedPage.BarItemColor="#B2B2B2"
android:TabbedPage.BarSelectedItemColor="#56D7A5"
android:TabbedPage.IsSwipePagingEnabled="False">
<TabbedPage.Children>
<NavigationPage Title="Page1" IconImageSource="navbar_page1">
<x:Arguments>
<views:page1 NavigationPage.HasNavigationBar="False" />
</x:Arguments>
</NavigationPage>
</TabbedPage.Children>
</TabbedPage>
page1.xaml.cs:
private void OpenPage()
{
Navigation.PushAsync(new page2());
}
So, to be clear, the result I have now, is that page2 has the TabbedPageBar
, so I need to use the NavigationPage
of the root, so the TabbedPageBar
goes away, but I have no idea how to do that.
Can someone help me
Solution
It is not a good design to put the Tabbed Page in a NavigationPage .It will has two navigation bar in the app .
Just set the Tabbed Page as MainPage directly .
MainPage = new MainPage();
Answered By - Lucas Zhang - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.