开发者

While using silverlight, is there a way to use a button to change the webpage?

I have an AS开发者_如何学CP.MVC application which has a silverlight app inside. I want to change the page when I click one of my buttons. Is there a way to make it?


I think the HtmlPage.Navigate method is probably what you're looking for.

You'll need the following using statement: using System.Windows.Browser;

HtmlPage.Window.Navigate(new Uri("http://www.mypage.com/newPage.html"));

Just stick this guy in the click event of your button and it should do what you want.

Also, if you wish to navigate within your website, you can use a Relative URI, like so:

HtmlPage.Window.Navigate(new Uri("newPage.html", UriKind.Relative));


What should be done is to use the using System.Windows.Browser; statement, and the, in the click method, add the following code:

HtmlPage.Window.Navigate(new Uri("http://yourpagegoeshere.com"));

Thanks overhed!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜