How to navigate between pages in an application ?

Platform: WPF| Category: Page

Navigation in an application can be done in a pre-determined linear sequence, a user driven path through hierarchy or a dynamically generated path.

Navigation can be performed using the following methods:

  • Using Navigate method
  • Navigate method in the Navigation service can be used to navigate to a page in the application.

    [C#]
    
           //Navigate using URI.
    this.NavigationService.Navigate(new Uri('mypage.xaml', UriKind.Relative));
    
          //Navigate to an instance of a page.
              mypage newpage = new mypage();
       this.NavigationService.Navigate(newpage);
    
  • Using Hyperlinks
  • “NavigateUri” property of Hyperlink markup extension can be used to open a page using hyperlink.

    [XAML]
    
                  <TextBlock>
          	<Hyperlink NavigateUri='mypage.xaml'>New Page</Hyperlink>
    </TextBlock>
    
  • Using the journal
  • Both navigation containers have a journal that records navigation history like a web browser. The journal maintains two stacks for ’Back’ and ’Forward’ stacks to record navigation.

    Share with

    Related FAQs

    Couldn't find the FAQs you're looking for?

    Please submit your question and answer.