Silverlight 3 page navigation

Source: Internet
Author: User
A new feature of Silverlight 3 is API S provides a navigation Framework To redirect the page.

This method is provided in APP. XAML to use its URI ing.Mechanism.

  1. 1: <application xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. 2: xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
  3. 3: X: class = "navigationsample. app"
  4. 4: xmlns: navcore = "CLR-namespace: system.Windows. Navigation; Assembly = system. Windows. Controls. Navigation ">
  5. 5: <application. Resources>
  6. 6: <navcore: urimapper X: Key = "urimapper">
  7. 7: <navcore: urimapping uri = "about-us" mappeduri = "/views/aboutpage. XAML"/>
  8. 8: </navcore: urimapper>
  9. 9: </application. Resources>
  10. 10: </Application>

CopyCode

If you are not sure about the absolute path of the page, you can also use wildcards to enable dynamic URI injection.

    1. 1: <navcore: urimapper X: Key = "urimapper">
    2. 2: <navcore: urimapping uri = "{}{ page}" mappeduri = "/views/{page}. XAML"/>
    3. 3: </navcore: urimapper>

Copy code

This is very friendly. It can help you achieve absolute page Jump dynamically.

You can also follow naming rules. For example, if you are sure you only need to restrict routing on the page or other pages, you can name your view page "xx Page. then you can write a route as follows:

    1. 1: <navcore: urimapper X: Key = "urimapper">
    2. 2: <navcore: urimapping uri = "{}{ page}" mappeduri = "/views/{page} page. XAML"/>
    3. 3: </navcore: urimapper>

Copy code

These navigation routes are read from top to bottom, so by default, you can still have clear (or Scalable) routes at the same time. The following code is provided:

    1. 1: <navcore: urimapper X: Key = "urimapper">
    2. 2: <navcore: urimapping uri = "about-us" mappeduri = "/views/aboutpage. XAML"/>
    3. 3: <navcore: urimapping uri = "History" mappeduri = "/views/aboutpage. XAML"/>
    4. 4: <navcore: urimapping uri = "{}{ page}" mappeduri = "/views/{page}. XAML"/>
    5. 5: </navcore: urimapper>

Copy code

When an access request about-US, history, or about page is sent, it is directed to/views/aboutpage. XAML. This provides you with a certain degree of scalability and granularity, and also provides additionalSearch

Related Article

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.