Windows phone7 Study Notes 02 -- page navigation

Source: Internet
Author: User

Almost all real applications do not have only one XAML page, so page navigation is particularly important. Page navigation involves not only page jumps, but also data transmission between pages and heavy loading of Back buttons. This section only provides simple page navigation, data transmission, and Back buttons for further writing.

1. Use XAML for page navigation In fact, it is to use the navigateuri attribute of the hyperlinkbutton control to navigate. For example, A URI is similar to a generic Resource Identifier (Uniform Resource Identifier) of a URL. It can be used to navigate within an application or even connect to content on the web. 2. Use C # code navigation;This is essentially the same as the previous method. It only writes the jump in an event of a control, usually in the click Time. For example, navigationservice. navigate (New uri ("/views/music. XAML", urikind. Relative )); 3. Address alias (1) first in the app. add the namespace: xmlns: nav = "CLR-namespace: system. windows. navigation; Assembly = Microsoft. phone "; (2) In app. <application. resources>, such
        <nav:UriMapper x:Key="UriMapper">
<nav:UriMapping Uri="Music" MappedUri="/View/Music.xaml"></nav:UriMapping>
</nav:UriMapper>
(3) The urimapper object used in the application also needs to set the object in the resource dictionary in the rootframe of the application. Add the following to the app. XAML. CS constructor:
        this.RootFrame.UriMapper = Resources["UriMapper"] as UriMapper;
(4) You can use the XAML or background code to implement navigation, for example:
          <HyperlinkButton NavigateUri="Music"/>
        NavigationService.Navigate(new Uri("Music", UriKind.Relative));

The following is a reference article: http://www.cnblogs.com/konck/archive/2012/01/10/2318232.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.