WPF WebBrowser 中的 Silverlight 应用程序? [英] Silverlight App inside WPF WebBrowser?

查看:29
本文介绍了WPF WebBrowser 中的 Silverlight 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个希望微不足道的问题.目前,我的公司使用一种相当晦涩的语言 (SyngergyDE),我们需要在我们的产品中调用 SilverLight 应用程序.不幸的是,这种晦涩的 3rd 方语言仅(当前)支持打开 WPF 屏幕.话虽如此,我想我会开发一个小型 WPF 用户控件,其中包含一个WebBrowser"控件并导航到 Silverlight 应用程序的 URI.这很好用,我可以看到 SL 应用程序.这是我的问题 - 我们在 SL 应用程序上有一个关闭"按钮,当用户单击"该按钮时,我们希望窗口关闭.

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.

有没有人对我们如何将SL 应用程序的关闭"传达给 WPF 用户控件以便整个 WPF 用户控件也关闭有任何建议?

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?

谢谢大家,

-汤姆

推荐答案

将事件处理程序附加到 WebBrowser.Navigated 事件.

Attach an event handler to the WebBrowser.Navigated event.

在 Silverlight 应用程序中使用关闭按钮:-

Have the close button in the Silverlight application use:-

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

当 Navigated 事件在 WPF 中使用 url "about:blank" 触发时,就该关闭控件了.

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

这篇关于WPF WebBrowser 中的 Silverlight 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆