首页 > 解决方案 > 无法从“页面”转换为“Xamarin.Forms.Page”

问题描述

我想导航到 Xamarin Forms 中的其他页面,但它不起作用。我的代码是:

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

错误是:

无法从“页面”转换为“Xamarin.Forms.Page”。顺便说一下,“页面”在 contentView 中。

标签: c#xamlxamarinxamarin.formsnavigation

解决方案


您无法导航到内容视图,因此CreateExpense应该使用Xamarin.Forms并且应该继承ContentPage,因此您应该执行以下操作CreateExpense

using Xamarin.Forms;

class CreateExpense : ContentPage

推荐阅读