How to Change the Start Page of the Xamarin Forms Application ?

This post will explain how you can change the start page of the Xamarin Forms application in C# when developing android and iOS apps.

By default , when you create a new Xamarin Forms application in Visual Studio , it creates a MainPage.xaml in the portable (PCL) project and this is set as the start page of your android and iOS application that is part of the solution.

How to Change the Start Page of the Xamarin Forms Application ?

You can change the start page of the Xamarin Forms application by changing the MainPage property App class defined in the App.xaml.cs file in the shared project.

public App()
{
    InitializeComponent();

    MainPage = new MainPage();

}

Assume that the new page name is FirstPage.Xaml and the class is FirstPage , then following would be set to the MainPage property to set the FirstPage.xaml as startpage.

public App()
{
    InitializeComponent();

    MainPage = new FirstPage();

}

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the error message “WorkbookNotSupported – The file you selected cannot be opened because it...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SpecifiedRangeNotFound – The requested range does not exist in the sheet.”...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SheetRangeMismatch – The sheet provided as the sheet argument is not...
  • .NET
  • December 17, 2022