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 “FileOpenAccessDenied – You do not have permissions to open this file...
  • .NET
  • December 3, 2024
You might have had a situation where your code once worked fine in ASP.NET application but now throws the below...
  • .NET
  • December 3, 2024
C# uses the flower bracket “{” and “}” to identify the block or scope of the function or program ....
  • .NET
  • December 3, 2024