Hello @Sreenivasan, Sreejith !
The behavior you’re seeing comes from a change in how FlyoutPage manages its lifecycle in .NET MAUI compared to Xamarin.Forms. In Xamarin.Forms, the IsPresented property and navigation stack were more forgiving. In MAUI, however, the flyout lifecycle is stricter, and reassigning CurrentPage while toggling the flyout interrupts the process.
That’s why your menu opens the first time, but fails to reopen if you’re still on the Dashboard tab — the forced CurrentPage reset cancels the flyout. Once you switch tabs, the state is refreshed, and the menu works again.
Here are some approaches you can choose to fix it:
Remove the CurrentPage reset in MenuOpenClose and HomePageIsPresentedChanged
The main issue is the CurrentPage = Children[lastSelectedItemIndex] line. Removing it usually resolves the problem:
public void MenuOpenClose(bool isPresented)
{
if (MainService.HomePage.Value is DashboardMasterPage masterpage)
{
FlyoutPage homePage = masterpage;
homePage.IsPresentedChanged -= HomePageIsPresentedChanged;
homePage.IsPresentedChanged += HomePageIsPresentedChanged;
homePage.IsPresented = isPresented;
menuIsOpen = isPresented;
// CurrentPage = Children[lastSelectedItemIndex]; // Remove this in MAUI
}
}
void HomePageIsPresentedChanged(object sender, EventArgs e)
{
if (MainService.HomePage.Value is DashboardMasterPage masterpage)
{
FlyoutPage homePage = masterpage;
menuIsOpen = homePage.IsPresented;
}
var menuPageType = NavigationService.GetPageType<AppMenuViewModel>();
var appMenuViewModel = Children.FirstOrDefault(p => p.GetType() == menuPageType)?.BindingContext as AppMenuViewModel;
if (appMenuViewModel != null)
{
appMenuViewModel.IsMenuPresented = menuIsOpen;
}
// CurrentPage = Children[lastSelectedItemIndex]; // Remove this in MAUI
}
Set FlyoutPage.FlyoutLayoutBehavior
In MAUI, the default flyout layout can vary by platform. To avoid conflicts, explicitly set it in your DashboardMasterPage:
FlyoutLayoutBehavior = FlyoutLayoutBehavior.Single;
This ensures the flyout overlays the detail page instead of trying to push it aside.
Restore the last tab only when needed
If you still want to return to the last tab after the menu is opened, handle it in HandleCurrentPageChanged instead of forcing it during the flyout toggle:
void HandleCurrentPageChanged(object sender, EventArgs e)
{
var i = Children.IndexOf(CurrentPage);
var menuPageType = NavigationService.GetPageType<AppMenuViewModel>();
if (CurrentPage.GetType() == menuPageType)
{
MenuOpenClose(true);
// Don’t reset CurrentPage here
}
else
{
lastSelectedItemIndex = i;
}
}
I hope this clears things up!