如何在单击按钮时更改XAML页面 [英] How to change XAML page on button click

查看:146
本文介绍了如何在单击按钮时更改XAML页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个xaml页面,并且主页上有一个按钮
当我单击按钮时,我想导航到另一页
我用过

I have 2 xaml pages and i have one button on main page
when i click button i want to navigate to another page
i have used

HtmlPage.Window.Navigate(new Uri("http://localhost:3858/SilverlightGridTestPage.aspx#/Views/bldghome.xaml"));



此行可以更改页面并且可以正常工作,但是它不执行服务器端代码



this line to change page and this works, but it does not execute serverside code

is there any alternative for this???

推荐答案

HtmlPage.Window.Navigate用于导航到html页面.如果要通过Silverlight导航到html页面,则可以使用HtmlPage.Window.Navigate.但是如果您想导航到另一个xaml页面,则需要这样做.
您必须使用导航框等其他技术.

请参考此链接以了解一个想法:-
http://www.longhorncorner.com/UploadFile/nipuntomar/Silverlight209112008012441AM/Silverlight2.aspx [ ^ ]

http://www.vistax64.com/avalon/50603-how-navighate- between-xaml-pages.html [ ^ ]
HtmlPage.Window.Navigate is used to navigate to html page. if you want to navigate to a html page through silverlight you can use HtmlPage.Window.Navigate. but if u want to navigate to another xaml page this want work.
you have to use other techniques like navigation frame..

refer this links to get an idea:-
http://www.longhorncorner.com/UploadFile/nipuntomar/Silverlight209112008012441AM/Silverlight2.aspx[^]

http://www.vistax64.com/avalon/50603-how-navighate-between-xaml-pages.html[^]


Indrajeet Sutar写道:
Indrajeet Sutar wrote:

但它没有执行服务器端代码

but it does not execute serverside code


如果在bkdgghome.xaml的构造函数中调用此服务器端代码怎么办?


What if this serverside code is called in the constructor of bkdgghome.xaml?


这篇关于如何在单击按钮时更改XAML页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆