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