How to push pages to MasterDetailPage using Mvvm

I want to use Mvvm for MasterDetailPage development. But facing issue to push new ContentPage to Detail

If I am using code behind than no issue, I can do like below

private void Button_Clicked(object sender, System.EventArgs e)
  Detail=  new NavigationPage(new Menu1Page());

But when it comes to Mvvm in ViewModel I don't have Detail page access there. So I can this, but it is hiding MasterDetailPage

async Task Menu1Page()
   await Xamarin.Forms.Application.Current.MainPage.Navigation.PushModalAsync(new Menu1Page());

So, how can push pages to Detail from Mvvm?

1 answer

  • answered 2018-11-08 08:08 wcoder

    By default, no.

    You need to define BindingContext for the page, and use code-behind navigation.

    Or use NavigationService, more details Enterprise App Navigation

    Or use any Mvvm framework for this.