开发者

How can I open an aspx page in a new browser window from a SilverLight Application?

开发者 https://www.devze.com 2023-01-19 02:40 出处:网络
I want to add a button to my user control in SilverLight 4.0 application which will open a new browser window with an aspx in it when it is clicked.开发者_如何学JAVA

I want to add a button to my user control in SilverLight 4.0 application which will open a new browser window with an aspx in it when it is clicked.开发者_如何学JAVA

How can I achieve this, can you please advice?

Additionaly, can I lock the SL application until this new window is closed (Alike a modal dialog)?

thanks!


You can open a new window with:-

 HtmlPage.Window.Navigate(uriToNewPage, "_blank");

However modal dialogs depend on the specific browser that is hosting. Internet Explorer and Firefox both have a showModalDialog method on their window objects. You would need to use the Invoke method to fire these:-

 HtmlPage.Window.Invoke("showModalDialog", urlString);


Use the HyperlinkButton control. You can specify to open in a new tab or new browser window.

(There is also a navigate option available from the Http class, but I will have to look up the syntax).

To do the modal popup scenario, you would need to generate a popup in Javascript on the browser hosting the SL control (which you can trigger from within Silverlight).

0

精彩评论

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