本文介绍了我在“主要详细信息"页面中收到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我使用默认模板创建了一个标准的xamarin表单项目,然后向该项目添加了一个Master Detail页面模板,当我在电话上编译该项目时,我打开了侧边菜单,当我单击Page 1时,我得到了错误"System.InvalidCastException:指定的类型转换无效."我不以任何方式更改默认模板,但出现错误,我认为它与过渡到第1页有关,我不了解原则上会发生这种过渡.谢谢.在此处输入图片描述

So I create a standard xamarin form project with a default template, then I add a Master Detail page template to the project and when I compile this project on the phone I open the side menu and when I click on Page 1 I get the error "System.InvalidCastException: Specified cast is not valid. " I do not change the default template in any way, but I get an error, I believe that it is related to the transition to Page 1 and I do not understand by what principle this transition occurs. Thanks.enter image description here

推荐答案

问题与您的视图名称有关,即页面",或者xamarin表单中已经存在具有相同名称页面"的类型,请尝试命名更清晰.要解决您的问题,请尝试强制输入xamarin表单类型

The problem is related to the name of your view is "Page" or already there is a type in xamarin forms with the same name "Page" try making names more clear.to resolve your problem try forcing the xamarin forms type

(Xamarin.Forms.Page)Activator.CreateInstance(item.TargetType)

这篇关于我在“主要详细信息"页面中收到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 04:00