Geeks With Blogs

News Opinions and articles on this blog are mine alone and do not represent my employer. All articles and blog entries are posted using a personal computer system outside of my employer network.
Sam Abraham Software Engineer/Architect: Putting Customers First

The Silverlight Navigation Framework offers great value when looking to map longer XAML page URLs to much shorter, friendlier and memorable ones. This feature is similar in nature to the ASP.NET MVC Routing engine. For instance, the following is a quick sample on how to leverage the Navigation Framework.  For this to work, I  had to:

1-Add reference to System.Windows.Controls.Navigation.dll in my Silverlight project

2-Add the following declaration in my App.xaml page:
xmlns:nav="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"

I was then able to leverage URI mapping in App.xaml as following:

<Application.Resources>
    <nav:UriMapper x:Key="uriMapper">
	<nav:UriMapping Uri="/{ParamVal}"
		MappedUri="/Site1/TestPage.xaml?Param={ParamVal}" />
   </nav:UriMapper>
</Application.Resources>

The above example will be mapping the base URL of a site to the path /Site1/TestPage.xaml and will pass the parameter value supplied in the simplified URL to the more complex mapped URL.

That simple! J

 

Posted on Thursday, June 9, 2011 2:47 PM Fladotnet.com , Tech Talk , Silverlight , .Net 4.0 | Back to top


Comments on this post: All in a Day's Work: The Silverlight Navigation Framework

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Sam Abraham | Powered by: GeeksWithBlogs.net