在 .NET Maui 的 Mopup 窗口中打开导航页面

问题描述 投票:0回答:1

我正在使用 .NET Maui 编写一个应用程序,并使用 Mopup Nuget 包。应打开一个弹出窗口,并从那里通过按钮打开导航页面。不幸的是,当单击该按钮时,没有出现导航页面。仅当我关闭 mopup 窗口时,才会显示导航页面。但是,如果我先关闭弹出窗口,正如我所说,导航页面不会显示。我该如何解决这个问题?非常感谢你



using Mopups.Services;
using Mopups.Pages;

namespace FinanceTracker.Pages;

public partial class ExpenseEntryWindow : PopupPage
{
    public ExpenseEntryWindow()
    {
        InitializeComponent(); 
    }

    private void btnAbbrechen_Clicked(System.Object sender, System.EventArgs e)
    {
        MopupService.Instance.PopAsync();    
    }


    private async void btnNavigation_Clicked(object sender, EventArgs e)
    {
        await Navigation.PushAsync(new NewPage1());
    }

}

.net xamarin xamarin.forms maui
1个回答
0
投票

您的方法应该调用 Mopup 和导航的关闭

private async void btnNavigation_Clicked(object sender, EventArgs e)
{
    await MopupService.Instance.PopAsync();    
    await Navigation.PushAsync(new NewPage1());
}

如果您还有任何疑问,请告诉我

© www.soinside.com 2019 - 2024. All rights reserved.