Mvvmcross: The master menu stays open after navigation

Created on 29 Oct 2017  路  2Comments  路  Source: MvvmCross/MvvmCross

While the default Xamarin.Forms master menu page is closed after the navigation, I cannot reproduce this with MVX. The menu stays always open.

forms bug

Most helpful comment

You need to trigger it from your navigate method:

c# if(Xamarin.Forms.Application.Current.MainPage is MasterDetailPage masterDetailPage) { masterDetailPage.IsPresented = false; } else if(Xamarin.Forms.Application.Current.MainPage is NavigationPage navigationPage && navigationPage.CurrentPage is MasterDetailPage nestedMasterDetail) { nestedMasterDetail.IsPresented = false; }

All 2 comments

You need to trigger it from your navigate method:

c# if(Xamarin.Forms.Application.Current.MainPage is MasterDetailPage masterDetailPage) { masterDetailPage.IsPresented = false; } else if(Xamarin.Forms.Application.Current.MainPage is NavigationPage navigationPage && navigationPage.CurrentPage is MasterDetailPage nestedMasterDetail) { nestedMasterDetail.IsPresented = false; }

While the default Xamarin.Forms master menu page is closed after the navigation, I cannot reproduce this with MVX. The menu stays always open.

Just put this IsPresented = false;
Inside the method.

Example:

private void GoToPerfil1(object sender ,EventArgs args)
{
Detail = new NavigationPage(new Pages.Perfil1());

        **IsPresented = false;**
    }
Was this page helpful?
0 / 5 - 0 ratings