1
votes

I have a Xamarin forms app with 3 Modules.. Im using Prism Pattern. So i followed Brian's git. From the App.cs to the MainPage my MasterPage works fine.. Also im using IconNavigationPage it works fine. Now when i to navigate to my Module, IconNavigatePage works fine but my master Page is not there..

in my App.cs

if i do this i see the master Page on my MainPage which is the entry page

 NavigationService.NavigateAsync("NavigationPage/MyMasterDetail/MainPage");

From my MainPage i load my Module and navigate to it if i do this to navigate to my module the navigation Bar is there

await _navigationService.NavigateAsync("Dashboard");

in my module there is no MasterDetail but there is NavigationMaster which inherts from Content Page like this

my wish is to display masterpage in my module only..

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="ModuleA.Views.MasterNavigation"
         Title="Module A Navigation">

and in my initialize code of my moduke i have this

var masterDetail = PrismApplication.Current.MainPage as MasterDetailPage;
        if (masterDetail != null)
           masterDetail.Master = new MasterNavigation();
1

1 Answers

1
votes

You need to change from

NavigationService.NavigateAsync("NavigationPage/MyMasterDetail/MainPage");

To

NavigationService.NavigateAsync("MyMasterDetail/NavigationPage/MainPage");

So you can do

await _navigationService.NavigateAsync("Dashboard");

And it will navigate in the context of the parent(NavigationPage) of the current page (MainPage) keeping the MasterDetail.