Opening a New Chrome Page In Silverlight
Silverlight works awesome in Internet Explorer when it comes to opening a link in a new browser window. Sadly, this is not the case when it comes to other browsers, but there is hope.
Create a new Silverlight Application in Visual Studio 2010. And add a button to your page. Let’s try to navigate to http://www.silverlight.net address when we click on this button.
Add this to the code behind of this button by double clicking the button (we will use code behind for demonstration purposes):
{
HtmlPage.Window.Navigate(new Uri("http://www.silverlight.net", UriKind.RelativeOrAbsolute), "_blank");
}
And then start your project in Chrome; click the button and you will see that it will not do anything. Open the same page in Internet Explorer, it will work as advertised.
The trick is to use the Hyperlink Button here. Now, go ahead and add a new hyperlink button to your page. Now same kind of code behind for the hyperlink button click:
{
this.hyperlinkButton1.TargetName = "_blank";
this.hyperlinkButton1.NavigateUri = new Uri("http://www.silverlight.net/");
}
Of course you can set the hyperlink button properties on the properties page as well, if you know the hyperlink in advance.
If you search for this problem, you will see that there is a JavaScript solution as well; however, I could not get that to work on my projects.