How can I open an aspx page in a new browser window from a SilverLight Application?
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).
精彩评论