Silverlight 3 页面导航
2010-03-02 12:23
351 查看
Silverlight 3 的一个新特性是通过在其APIs中提供一个导航框架来实现页面的跳转。
在App.xaml里提供了这种方式来使用它的Uri映射机制。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>
复制代码如果你不确定页面的绝对路径,你还可以通过通配符来实现动态的Uri影射。1: <navcore:UriMapper x:Key="uriMapper">
2: <navcore:UriMapping Uri="{}{page}" MappedUri="/Views/{page}.xaml" />
3: </navcore:UriMapper>
复制代码这样做十分友好。可以动态帮你实现页面的绝对路径跳转.
你还可以按照一些命名规则,比如你确定你仅需要在页面或者其他什么上限制路由,你可以给你的视图页面命名为"某某Page.xaml",那么你可以编写路由就像这样:1: <navcore:UriMapper x:Key="uriMapper">
2: <navcore:UriMapping Uri="{}{page}" MappedUri="/Views/{page}Page.xaml" />
3: </navcore:UriMapper>
复制代码这些导航路由是自上而下读取的,所以默认状态下你仍然可以同时拥有明确的(或扩展的)路由。 因此给出如下代码: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>
复制代码当一个访问请求About-Us,History或者About页面,都会导航到/Views/AboutPage.xaml上。这就提供给你的实现一定的可伸缩性和粒度性,同时也为你的页面内容提供附加的搜索
在App.xaml里提供了这种方式来使用它的Uri映射机制。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>
复制代码如果你不确定页面的绝对路径,你还可以通过通配符来实现动态的Uri影射。1: <navcore:UriMapper x:Key="uriMapper">
2: <navcore:UriMapping Uri="{}{page}" MappedUri="/Views/{page}.xaml" />
3: </navcore:UriMapper>
复制代码这样做十分友好。可以动态帮你实现页面的绝对路径跳转.
你还可以按照一些命名规则,比如你确定你仅需要在页面或者其他什么上限制路由,你可以给你的视图页面命名为"某某Page.xaml",那么你可以编写路由就像这样:1: <navcore:UriMapper x:Key="uriMapper">
2: <navcore:UriMapping Uri="{}{page}" MappedUri="/Views/{page}Page.xaml" />
3: </navcore:UriMapper>
复制代码这些导航路由是自上而下读取的,所以默认状态下你仍然可以同时拥有明确的(或扩展的)路由。 因此给出如下代码: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>
复制代码当一个访问请求About-Us,History或者About页面,都会导航到/Views/AboutPage.xaml上。这就提供给你的实现一定的可伸缩性和粒度性,同时也为你的页面内容提供附加的搜索
相关文章推荐
- Silverlight Navigation-Silverlight页面间自定义导航
- silverlight程序,在多页面之间进行导航
- silverlight for win phone页面导航
- Silverlight Navigation-Silverlight页面间自定义导航
- Silverlight 页面导航
- Silverlight中页面导航
- Silverlight中的页面导航
- silverlight开发实例(Prism+MVVM+RIA)(三)--创建页面导航
- silverlight 页面之间的导航汇总
- 织梦DedeCms去掉栏目页面包屑导航最后的分隔符“>”
- 页面滚动定位导航添加样式
- Silverlight实用窍门系列:51.Silverlight页面控件的放大缩小、Silverlight和Html控件的互相操作
- win8页面导航--删除当前页面堆栈信息
- Silverlight实例教程 - Navigation导航框架URI映射机制
- 关于Silverlight页面跳转的总结
- Silverlight弹出新页面
- Asp.net页面中通过Js控制Silverlight显示值
- 导航菜单跳转后,新页面上菜单CSS选定
- 页面导航 页面内容的保存,
- 让页面目标元素 “固定” 在浏览器窗口的顶部 stickUp+jQuery.pin 插件 使用 单页导航