Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.

Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?

Thanks everyone,

-Tom

like image 224
arctek Avatar asked Nov 14 '22 05:11

arctek


1 Answers

Attach an event handler to the WebBrowser.Navigated event.

Have the close button in the Silverlight application use:-

 HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));

When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.

like image 72
AnthonyWJones Avatar answered Dec 07 '22 22:12

AnthonyWJones