Windows Phone 8.1 and Windows Runtime Apps How to #13 – How to Change the Start Page of the App ?

When you create a Windows Phone 8.1 app in Visual Studio 2013 , the MainPage.xaml is set as the default start page of the app . Sometimes , you might want to change the start page of the Windows Phone 8.1 App from MainPage.xaml to a different page.

How to Change the Start Page of the Windows Phone 8.1 App (Windows Runtime App) ?

To change the start page of the Windows Phone 8.1 app , follow the below steps.

1. Open the Windows Phone 8.1 Project in Visual Studio 2013 .Double click the App.xaml.cs file from solution explorer.

2. The App.xaml.cs contains the Onlaunched event where the start page is defined . By Default , the MainPage is the start page of the application.

image

3. Create a new xaml page from solution explorer and name it as “NewMobileOSGeekPage.xaml” . Now , replace “MainPage” with the NewMobileOSGeekPage in the OnLaunched event page .

if (!rootFrame.Navigate(typeof(NewMobileOSGeekPage), e.Arguments))
{
   throw new Exception("Failed to create initial page");
}

Build and run your app on the Windows Phone 8.1 emulator . You should see the app running with the new start page that is set.

Leave a Reply