Silverlight3: sivlerlight.net site navigation framwork sample code

Source: Internet
Author: User

Today, I saw this article on timheuer blog.ArticleA Guide to Silverlight 3 new features. I found the introduction to navigation framwork interesting. I clicked the link to view video, downloaded the Cs source code, and opened it with vs2008, the following error occurs: An unhandled exception ('unhandeld error in Silverlight application navigation is ony supported to relative Uris that are fragments, or begin with '/', or which contain ''; component/'parameter name URI at system. windows. navigationservic. nagivationcore (URI Uri ,)

I watched the video again and compared it with the demo in the timeheuer video.CodeNothing is different from the downloaded code. then I created a project with Silverlight navigation as the template. The new project can run normally and some differences are found during comparison, so I immediately realized that the videos and sample code of the silverlight.net site are not Silverlight RTM, but silverligh3 beta.

The following steps are used to modify the sample code of navigation framwork of silverlight3 beta so that it can run properly in Visual Studio 2008 SP1:

1. if an error occurs: An unhandled exception ('unhandeld error in Silverlight application navigation is ony supported to relative Uris that are fragments, or begin with '/', or which contain ''; component/'parameter name URI at system. windows. navigationservic. nagivationcore (URI Uri,) You need. add '/' before the TAG content in XAML, app. the same is true for the URI content in the Xmal file.

2. after compilation, if you open the browser, the following error occurs: An unhandled exception ('unhandeld error in Silverlight Application No XAML was found at the loaction'/home '. at system. windows. navigation. pageresourcecontentloader...

This error is caused. the mainframe in XAML does not specify urimapper. Add urimapper = "{staticresource urimapper}" (urimapper in app. XAML file) or the app. the urimapper content in the xaml file is added to mainframe to become its sub-element. The mainpage of the project created using the navigation framwork template is written in that way.

3. Complete this step, for exampleProgramIt can run, but you will find that the URI in the browser will change normally, such as http: // localhost: 27637/navigationsampletestpage.html/# Home; http: // localhost: 27637/navigationsampletestpage.html/# About, and IE's forward and backward buttons are unavailable, therefore, you also need to add id = "_ sl_historyframe" to the IFRAME of HTML in the corresponding web project. After compilation, the above two problems are normal, and the final problem is customer. an error in Xmal. The cause is the same as step 1. Add '/' before URI '/'.

The sample code for the navigation framework on silverlight.net is the correct example in silverlight3 RTM. I found this problem on the Internet for a long time and almost no one mentioned it, however, this was a big mistake, and timeheuer was not even aware of it. However, if you want to learn or learn the navigation framework later, you don't need to worry about it.

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.