关于工程内xaml间的跳转问题

fanshaoer 2010-06-24 01:02:56
我有两个xaml文件,一个是MainPage.xaml,另一个是Page1.xaml

默认启动的时候,page1是不会被载入的,所以我想在MainPage.xaml上添加个button或者超链接button来实现跳转,比如


<HyperlinkButton Content="Jump to the Page1"
Canvas.Left="731" Canvas.Top="9"
Height="34" Width="190"
NavigateUri="/Page1.xaml"
FontSize="16" FontFamily="Arial"
TargetName="_blank" Cursor="Hand"/>


但是在新窗口中出现HTTP 404 错误提示。。。我想问下,这个HyperlinkButton控件中的NavigateUri="/Page1.xaml"属性写法也错误么??为什么无法实现跳转呢。。

谢谢!
...全文
186 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fanshaoer 2010-06-28
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 jv9 的回复:]

引用楼主 fanshaoer 的回复:
我有两个xaml文件,一个是MainPage.xaml,另一个是Page1.xaml

默认启动的时候,page1是不会被载入的,所以我想在MainPage.xaml上添加个button或者超链接button来实现跳转,比如


C# code

<HyperlinkButton Content="Jump to the Page1"
C……
[/Quote]哦,原来是这样,设计思路有变啊,谢谢!!
jv9 2010-06-26
  • 打赏
  • 举报
回复
[Quote=引用楼主 fanshaoer 的回复:]
我有两个xaml文件,一个是MainPage.xaml,另一个是Page1.xaml

默认启动的时候,page1是不会被载入的,所以我想在MainPage.xaml上添加个button或者超链接button来实现跳转,比如


C# code

<HyperlinkButton Content="Jump to the Page1"
Canvas.Left="731" Canv……
[/Quote]

对于页面跳转其实有很多方法,在Silverlight 3之前,通常使用页面容器切换的方式来切换页面,而Silverlight 3之后,通常推荐使用Navigation的功能。

使用Navigation,需要注意Uri的映射,详细可以参考:http://www.silverlightchina.net/html/tips/2009/1209/361.html

http://www.silverlightchina.net/html/tips/2009/1123/260.html

对于容器切换,可以参考:http://www.silverlightchina.net/html/tips/2010/0119/600.html
fanshaoer 2010-06-25
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 guoluren_kang 的回复:]

this.Content = new PrescriptionList();
这里的PrescriptionList 是PrescriptionList.xaml
[/Quote]
谢谢!学了几天,xaml的跳转还是不行,page或者frame是属于页面内的导航功能,其实我的问题和这个哥们问的一样,http://topic.csdn.net/u/20100415/17/20e5ffc5-8b41-4211-b991-83e569635816.html

老Key 2010-06-24
  • 打赏
  • 举报
回复
this.Content = new PrescriptionList();
这里的PrescriptionList 是PrescriptionList.xaml
fanshaoer 2010-06-24
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 guoluren_kang 的回复:]

推荐你看一下:
第一个:使用UserControl进行传值、页面导航
http://www.bbniu.com/forum/thread-389-1-1.html
第二个:使用Navigation系统中的Frame+Page进行传值、页面导航
http://www.bbniu.com/forum/thread-395-1-1.html
http://www.bbniu.com/foru……
[/Quote]

谢谢!果然xaml不可以直接跳转。。。另外,除了导航。。有没有关于button click事件的重定向例子啊,谢谢!!
老Key 2010-06-24
  • 打赏
  • 举报
回复
推荐你看一下:
第一个:使用UserControl进行传值、页面导航
http://www.bbniu.com/forum/thread-389-1-1.html
第二个:使用Navigation系统中的Frame+Page进行传值、页面导航
http://www.bbniu.com/forum/thread-395-1-1.html
http://www.bbniu.com/forum/thread-406-1-1.html
老Key 2010-06-24
  • 打赏
  • 举报
回复
<Navigate:frame/> 然后用<Hyperlinkerbutton target="" source="gsdg.xaml">就可以了。

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧