Issue with navigation of menu options from first tab of the flyout page
In my MAUI app, the homepage is implemented as a FlyoutPage, with the flyout serving as a menu and the detail section as a TabbedPage. The TabbedPage contains two tabs: "Alerts" and "Home." Both tabs include a menu button that opens the flyout menu. However, I am encountering an issue: when I open the menu from the "Alerts" tab and select any option, the app navigates to the "Home" tab instead of the selected page, and I can see the selected page on the Alerts tab. In contrast, if I open the menu from the "Home" tab and select an option, the correct page opens as expected.
Under AppMenuExtensions.cs the navigations are managing, below is the code:
private static async Task GoPredifinedScreen(INavigationService navService, AppMenu currentMenu)
{
if (!await ValidInternetConnection(navService))
return;
switch (currentMenu.ActionDetail.PermanentLink)
{
case "article":
await NavigateTo<ArticlesViewModel>(navService);
break;
case "participant_profile":
await NavigateTo<ProfileViewModel>(navService);
break;
case "contact":
await NavigateTo<ContactViewModel>(navService);
break;
case "video_consults":
case "videoconsults":
await NavigateTo<VideoConsultListViewModel>(navService);
break;
case "appointments":
case "appointment":
await NavigateTo<AppointmentsViewModel>(navService);
break;
case "logout":
break;
default:
{
var masterpage = MainService.HomePage?.Value as DashboardMasterPage;
if (masterpage != null)
{
masterpage.IsPresented = false;
var detailNavigationPage = masterpage.Detail as NavigationPage;
var dashboardTabPage = detailNavigationPage?.CurrentPage as DashboardTabPage;
if (dashboardTabPage != null)
{
var homePage = dashboardTabPage.Children?.FirstOrDefault(p => p.GetType() == NavigationService.GetPageType<MyTasksViewModel>());
if (homePage != null)
{
dashboardTabPage.CurrentPage = homePage;
}
}
}
}
break;
}
}
I think when I tap on the menu options from alerts tab the default section is activating and dashboardTabPage.CurrentPage = homePage; code is running. I am adding the AppMenuExtensions.cs as a text file below for the reference.