本文介绍了System.InvalidOperationException:Android上不全局支持PushAsync的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注此Xamarin表单快速入门指南(适用于多屏屏幕的指南)

I'm following this Xamarin Forms quick start guide (the one for multiscreen)

但是当我尝试运行完整的程序时出现此错误

BUT I get this error when I try to run the completed program

没有选择将"NavigationPage"添加到共享库项目中.

There is no option to add a 'NavigationPage' to the shared library project.

有什么想法吗?我正在使用Visual Studio 15.5.2和所有版本的最新版本,包括Windows 10.

Any ideas? I'm using Visual Studio 15.5.2 and latest version of everything including Windows 10.

注意:在本指南中,步骤4不再与Visual Studio匹配

NOTE: in this guide the step 4 no longer matches with Visual studio

不再有跨平台">表单Xaml页面",而是已被这些选项取代

There is no longer Cross-Platform > Forms Xaml Page, instead it has been replaced with these options

推荐答案

在您的Application子类中(如果由模板创建,通常在App.csApp.xaml.cs文件中),将您的第一页包装在NavigationPage页面中,然后现在您将能够推送和弹出页面.

In your Application subclass (normally in the App.cs or App.xaml.cs file if created by template), wrap your first page within a NavigationPage page and now you will be able to push and pop pages.

示例:

MainPage = new YourFirstPage(); 

将其包装在NavigationPage

MainPage = new NavigationPage(new YourFirstPage());

这篇关于System.InvalidOperationException:Android上不全局支持PushAsync的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 15:59