silverlightsilverlight-3.0out-of-browser

Silverlight 3 - Out of browser HtmlPage.Window.Navigate


Silverlight 3 allows you to run your application out of the browser, which installs a link on your desktop/start menu.

The problem is we are currently using

System.Windows.Browser.HtmlPage.
  Window.Navigate(new Uri("http://<server>/<resource>"), "_blank")

to load a URL into a new browser window (it's to provide a 'print friendly' page for users to print). This works in the normal SL in-browser version, but outside the browser we get 'The DOM/scripting bridge is disabled.' exception thrown when issuing the call.

Is there an alternative which works out of the browser?

I've seen Open page in silverlight out of browser but I need to do this entirely in code, so I don't want to add a (hidden) hyperlink button and then programmatically 'click' it (unless I absolutely have to...).


Solution

  • you can try inheriting from HyperlinkButton and exposing public Click() method (which you can then instantiate and call from code instead of declaring it in xaml). Details here: http://mokosh.co.uk/post/2009/10/08/silverlight-oob-open-new-browser-window/