Master Deteail Page不在Prism模块上工作

时间:2017-11-09 20:50:56

标签: xamarin xamarin.forms prism

我有一个带有3个模块的Xamarin表单应用程序..我使用Prism Pattern。所以我跟着Brian的git。从App.cs到MainPage我的MasterPage工作正常..我也使用IconNavigationPage它工作正常。现在,当我导航到我的模块时,IconNavigatePage工作正常,但我的主页面不在那里..

在我的App.cs中

如果我这样做,我会看到我的主页上的主页面是入口页面

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

从我的主页我加载我的模块并导航到它 如果我这样做导航到我的模块导航栏就在那里

await _navigationService.NavigateAsync("Dashboard");

在我的模块中没有MasterDetail但是有一个NavigationMaster来自内容页面的内容就像这样

我希望只在我的模块中显示主页..

<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">

                 

在我的moduke的初始化代码中,我有这个

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

1 个答案:

答案 0 :(得分:1)

您需要从

更改

html body #editModal.modal.fade(tabindex="-1", role="dialog", aria-labelledby="myModalLabel", aria-hidden="true") .modal-dialog .modal-content // Modal Header .modal-header button.close(type="button", data-dismiss="modal") span(aria-hidden="true") × span.sr-only Close h4#myModalLabel.modal-title | Edit Resource // Modal Body .modal-body #editForm.form(role='form' method='GET' action='https://www.google.com/') // CHANGE THIS! div.form-group label(for='name') Name: input#name.form-control(type='text', name='name', required='') div.form-group label(for='address') Address: input#address.form-control(type='text', name='address') div.form-group label(for='phone') Phone: input#phone.form-control(type='text', name='phone') div.form-group label(for='website') Website: input#website.form-control(type='text' name='website') div.form-group label(for='email') Email: input#email.form-control(type='email' name='email') div.form-group label(for='description') Description: textarea#description.form-control(type='text', name='description', rows = '5') button.btn.btn-primary(type="submit", name="asdf") Submit button.btn.btn-default(type="button", data-dismiss="modal") | Close

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

所以你可以做到

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

  

它会在当前页面的父(await _navigationService.NavigateAsync("Dashboard");)的上下文中导航(NavigationPage保留MasterDetail。 < / p>