Navigation in Windows Phone

Step 1: Create a Page in your project named as ‘NavigationPage.xaml’


Step 2: Add a button on this page with Content=’Navigate’ and create the click event of that button by clicking on the button.


Step 3: Create a new page named as ‘NextPage.xaml’


Step 4: Write some text on ‘NextPage.xaml’ for Identification via TextBlock


Step 5: Write the code on the .cs file of ‘NavigationPage.xaml’ page as mentioned below.

private void Button_Click_1(object sender, RoutedEventArgs e)
{

    Uri url = new Uri("/NextPage.xaml",UriKind.RelativeOrAbsolute);
    NavigationService.Navigate(url);

}

Note: ‘/ ’ is necessary before the path of your page which you want to show after the navigation or redirection like "/NextPage.xaml".


Step 6: Run the Application after setting the ‘NavigationPage.xaml’ as Navigation Page(Start Page) in WMAppManifest.xml which exist in properties Folder

Step 7: Click on the Navigate button and see the Next Page.

Ebook Download
View all
Learn
View all