Hello,
Xamarin support will end on May 1, 2024, it's recommended that you migrate your Xamarin app to .NET MAUI. Please see Xamarin official support policy .
Firstly, please open the NavigationService.cs
and find NavigateToAsync
method. I change the code in the else part. I set the App.Current.MainPage =new NavigationPage( tabPage);
When page is Tabbedpage, then change the MainPage is NavigationPage and navigated by navPage.Navigation.PushAsync
like following code.
public async Task NavigateToAsync<TPageModelBase>(object navigationData = null, bool setRoot = false)
where TPageModelBase : PageModelBase
{
var page = PageModelLocator.CreatePageFor(typeof(TPageModelBase));
if (setRoot)
{
if (page is TabbedPage tabbedPage)
{
App.Current.MainPage = tabbedPage;
}
else
{
App.Current.MainPage = new NavigationPage(page);
}
}
else
{
if (page is TabbedPage tabPage)
{
//change here, but you need to hide the navigationbar by the android:TabbedPage.ToolbarPlacement="Bottom" in the MenuPage.xaml
App.Current.MainPage =new NavigationPage( tabPage);
}
//change here, detect current Main page is Navigation page
else if (App.Current.MainPage is NavigationPage navPage)
{
//change here. navigate the detailed page
await navPage.Navigation.PushAsync(page);
}
else
{
App.Current.MainPage = new NavigationPage(page);
}
}
if (page.BindingContext is PageModelBase pmBase)
{
await pmBase.InitializeAsync(navigationData);
}
}
Next, please open the MenuPage.xaml add NavigationPage.HasNavigationBar="False"
to hide the navigationbar.
<TabbedPage
...
NavigationPage.HasNavigationBar="False">
And open the TreeInfoPage.xaml. please remove the android:TabbedPage.ToolbarPlacement="Bottom"
in the <ContentPage>
, after navgationg, you can see the back icon.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.