[英]Silverlight / WPF communication
I have a WebBrowser control showing a Silverlight application. 我有一个显示Silverlight应用程序的WebBrowser控件。 This control is in a WPF application.
此控件在WPF应用程序中。 Obviously this is a bit of a hack to integrate Silverlight with WPF as ultimately neither one knows about each other, they're completely independent.
显然,将Silverlight与WPF集成起来确实有点技巧,因为最终彼此都不认识,他们是完全独立的。
So what I need is for Silverlight to post a value into the WPF application. 因此,我需要Silverlight将值发布到WPF应用程序中。 What I was thinking was using JavaScript hosted in the .aspx page in the Silverlight application which can be accessed from both Silverlight and WPF.
我当时想的是使用Silverlight应用程序.aspx页中托管的JavaScript,可以从Silverlight和WPF进行访问。 I think it is fairly simple getting data from Silverlight to the .aspx page but I'm not sure how to get the data from the .aspx page to WPF.
我认为从Silverlight到.aspx页面获取数据非常简单,但是我不确定如何从.aspx页面获取数据到WPF。 Ideally I don't want WPF to have to call for the data, I want it to be posted from Silverlight and appear in the WPF application without WPF having to do anything except receive and display the data.
理想情况下,我不希望WPF调用数据,而是希望它从Silverlight发布并出现在WPF应用程序中,而WPF除了接收和显示数据外不必执行任何其他操作。
Hmm...hope that makes sense. 嗯...希望如此。
Silverlight to/from JavaScript: see here Silverlight往返JavaScript:请参见此处
MSDN - Making Silverlight Scriptable by JavaScript MSDN-使Silverlight可通过JavaScript编写脚本
WPF to/from JavaScript: see here WPF往返JavaScript:请参阅此处
Stack Overflow - Invoke C# code from JavaScript in a Document in a WebBrowser 堆栈溢出-从WebBrowser中的文档中的JavaScript调用C#代码
Code project - Working with webbrowser in wpf 代码项目-在WPF中使用Webbrowser
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.