问题
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
回答1:
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)
来源:https://stackoverflow.com/questions/49800777/i-get-an-error-in-master-detail-page