Setting up the .NET MAUI main page
Learn .NET MAUI creating projects
Learn how to create cross-platform applications, thanks to the power of .NET MAUI and a series of real projects.
One of the things to know when working with .NET MAUI projects, is how we can assign the home page for our applications. For this, we must go to the solution explorer and open the App.xaml.cs file:
Inside this file, we see a line indicating:
MainPage = new AppShell();
This line is the one that indicates which is the initial page of the application. In this case, AppShell is set to be the initial page.
We can change the initial page by creating a new instance of any other page, such as MainPage.xaml, which is also created by default with each new project:
MainPage = new MainPage();
If we start running the application, you may see a result similar to the following in your emulator (it may vary depending on the version of .NET MAUI):
You might think that the initial page is the same as using the AppShell page, but you will discover when you study about Shell that this is not true. Let's move on to analyze the first type of page, which is the type of page called ContentPage.
Below, you can watch a video demonstration to learn how to change the home page in .NET MAUI applications.