Setting Start Page of Windows Phone Dynamically Through Code

I will start with saying , this post is small and sweet, I was working and come across a requirement to set start page of Windows Phone Application through code or dynamically.

Essentially this one line of code will set the start page of the application.

WinPhone1.gif

Say, you have a page called Page1.xaml and you want to set it as start page of application. Then you will have to set start page in App.Xaml.csas below.

private void Application_Launching(object sender, LaunchingEventArgs e)
{          

    UrinUri = newUri("/Page1.xaml", UriKind.Relative);
    ((App)Application.Current).RootFrame.Navigate(nUri);          

}

This was all about setting the start page in Windows Phone application.

I hope this quick post was useful.

Thanks for reading.

Up Next
    Ebook Download
    View all
    Learn
    View all