博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SilverLight 4页面跳转大全
阅读量:6981 次
发布时间:2019-06-27

本文共 1703 字,大约阅读时间需要 5 分钟。

//Silverlight页面的跳转 

//(Application.Current.RootVisual as IContent).Content = new DragControl(); 
//普通页面跳转 
HtmlWindow html = HtmlPage.Window; 
//html.Navigate(new Uri("http://www.0379zd.com"));//普通网址 
html.Navigate(new Uri("../Index.aspx", UriKind.Relative));//相对路径

参考一:

方法一: 可跳转到网页 

                  HtmlWindow html = HtmlPage.Window; 
                  html.Navigate(new Uri(item.Link_Page.Trim(), UriKind.Relative), "_blank"); 
                   //System.Windows.Browser.HtmlPage.PopupWindow(new Uri(HtmlPage.Document.DocumentUri, item.Link_Page.Trim()), "_Blank",null); 
方法二:跳转到Xaml页 
            this.Content = new About(); 
方法三:框架跳转item.Link_Page.Trim():代表xaml名 e.g: /views/home   
           events = new System.Uri(item.Link_Page.Trim(), UriKind.Relative); 
           this.ContentFrame.Source = events; 
框架 
 <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" 
                              Source="/Views/About" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed"> 
                <navigation:Frame.UriMapper> 
                  <uriMapper:UriMapper> 
                    <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/> 
                    <uriMapper:UriMapping Uri="/Views/{pageName}" MappedUri="/Views/{pageName}.xaml"/>   
                    <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/{pageName}.xaml"/> 
                  </uriMapper:UriMapper> 
                </navigation:Frame.UriMapper>               
            </navigation:Frame>  
链接 
<HyperlinkButton x:Name="userid" NavigateUri="/Views/Home"  Style="{StaticResource LinkStyle}" TargetName="ContentFrame" />

参考二:

问题:从页面A跳转到页面B. 

方法:在页面A的cs文件中: 
1.先引入命名空间: 
    using System.Windows.Browser; 
2.跳转语句:

HtmlWindow html = HtmlPage.Window; 

html.Navigate(new Uri("/Default.aspx",UriKind.Relative));

注意黑体字部分,如果要使用相对路径的话,必须加上,全路径的话,可以不用. 

OK了,今天刚搞好的,也不知道可有其他办法了,再来找找,要有更好的办法,我再加进来吧.

本文转自cnn23711151CTO博客,原文链接:http://blog.51cto.com/cnn237111/622829 ,如需转载请自行联系原作者

你可能感兴趣的文章
html5--6-10 CSS选择器7--伪类选择器
查看>>
激光数据匹配(MATLAB Robotics System Toolbox)
查看>>
file_put_contents执行返回false,file_put_contents false(linux服务器httpd)
查看>>
Dependency Walker (depends.exe) Home Page
查看>>
Android---- 如何把calendar.getTimeInMillis()获得的毫秒时间
查看>>
Java学习JVM搞搞Jconsole呗
查看>>
JavaScript学习总结一(String对象的用法)
查看>>
lintcode:背包问题II
查看>>
处理手势冲突和错乱的一点经验
查看>>
Struts2防止表单重复提交
查看>>
[转]Python格式化输出
查看>>
在Activity中响应ListView内部按钮的点击事件
查看>>
CSS - 修改input - placeholder 和 readonly 的样式
查看>>
常用UI布局
查看>>
在多线程情况下 局部变量与全局变量 哪个比较安全呢
查看>>
算法评测
查看>>
40款非常酷的国外创意名片设计欣赏
查看>>
RadioGroup单选按钮用法
查看>>
POJ 2773 Happy 2006
查看>>
UBIFS介绍 - MTD网站
查看>>