Reputation: 1716
I am trying to Navigate from MainPage to another ContentPage in Xamarin Forms, but it throws some un-descriptive error message. I am following Hierarchical Navigation, but it doesn't help. The error appears in Android and IOS, but I didn't check with UWP as it is not required.
My App.cs
public App()
{
InitializeComponent();
MainPage = new NavigationPage(new MainPage());
}
and in MainPage, I have button click event
private async void Button_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new Page1());
}
and Page1.cs and Page1.XAML
[XamlCompilation(XamlCompilationOptions.Skip)]
public partial class Page1 : ContentPage
{
public Page1 ()
{
InitializeComponent();
}
}
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LocalDatabaseTutorial.Page1">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
and Also error message At first, what is the error message? and How do I navigate from one page to another page in Xamarin forms?
Upvotes: 1
Views: 1740
Reputation: 74124
Ensure that all your Xamarin.Forms
have matching versions between your projects (.NetStd libraries containing the Xamarin.Forms package, Xamarin.Android|iOS application projects, etc...).
Typically (always?) a ...resolve type with token XXX from typeref...
exception comes from a mismatch of a compiled/IL type from a runtime type (i.e. same assembly name but different version at runtime).
Upvotes: 1