带有 Prism 和 xamarin 形式的汉堡菜单不会出现

Hamburger menu with Prism & xamarin forms doet not appear

我正在尝试创建一个汉堡包菜单,但是当我启动该应用程序时,我看到一个空白页面。我正在使用 Prism 开发这个 android 应用程序,并且我遵循了这篇文章:https://dansiegel.net/post/2017/04/01/the-hamburger-menu-with-prism-forms 但对我来说它不起作用。

MainPage.cs

<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="HomeManagement.Views.MainPage">
    <MasterDetailPage.Master>
        <!-- Hamburger Menu Secret Sauce... Add an Icon!!!! Make sure it's in your resources for your Platform Project -->
        <NavigationPage Title="Required Foo" Icon="ic_launcher.png">
            <x:Arguments>
                <ContentPage Title="Menu">
                    <StackLayout Padding="40">
                        <Label Text="Test hello" />
                        <Button Text="HuePage"/>
                    </StackLayout>
                </ContentPage>
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Master>
</MasterDetailPage>

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace HomeManagement.Views
{
    public partial class MainPage : MasterDetailPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
    }
}

MainPageViewModel

using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HomeManagement.ViewModels
{
    public class MainPageViewModel : ViewModelBase
    {
        public string UserName { get; set; }

        public MainPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            Title = "Main hamburger";

        }
    }
}

有人知道发生了什么事吗?我正在使用 Prism 7.2 版。 提前致谢

据我所知,您正在分配母版页,但您似乎没有分配详细信息页面,这反过来又让您的屏幕空白!尝试为其分配详细信息页面

MainPage mainPage = new MainPage();
mainPage.Detail= new DetailPage();

或来自XAML

 <MasterDetailPage.Detail>
       <ContentPage Title="Detail">
                <StackLayout Padding="40">
                    <Label Text="Test hello" />
                    <Button Text="HuePage"/>
                </StackLayout>
            </ContentPage>
 </MasterDetailPage.Detail>