views:

22

answers:

2

Hi,

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.

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!

A: 

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).

Enough already
A: 

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);
AnthonyWJones
@AnthonyWJones: Well that saves me looking up the HtmlPage code now (*spoilsport*) :)
Enough already
@burak ozdogan: Go with what AnthonyWJones says :)
Enough already