michael__sloan
michael__sloan

Reputation: 425

Xamarin.Forms NavigationPage

I want to create a NavigationPage but I'm doing something wrong. Here's my stacktrace message: "Sequence contains no elements." Can someone help me pinpoint what's wrong with my code? I uploaded an image of an error I'm getting.

This is the code-behind for the xaml page:

namespace Quickies
{
public partial class QuickiesPage : NavigationPage
  {
    public QuickiesPage()
    {
        InitializeComponent();
    }
  }
}

Here's my "App" class

namespace Quickies
{
public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MainPage = new NavigationPage (new QuickiesPage());
    }

Upvotes: 1

Views: 376

Answers (1)

hyoyin_Kyuoma
hyoyin_Kyuoma

Reputation: 673

Navigation page constructor accepts Xamarin.Forms.Page object. You are trying to send a Navigation Page object. You can either do :

public partial class QuickiesPage : ContentPage

or (since I am not sure what you are trying to do)

MainPage = new QuickiesPage ();

Upvotes: 2

Related Questions