Reputation: 6082
I have a WPF application with a web browser control inside which is a silveriight application. Earlier, I have been able to call functions from WPF application to sliverlight application using HTML bridge.
Now, I have to do the opposite to this i.e. I have to call a function inside the WPF application from silverlight.
How can this be done?
Upvotes: 0
Views: 428
Reputation: 36
You can do this by using the property as shown below:
C# part :
webBrowserControlName.ObjectForScripting = new ScriptInterface();
where ScriptInterface is as follows
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class ScriptInterface
{
public void CSharpMethod(string data)
{
MessageBox.Show(data);
}
}
HTML part
in the page that you load in the web browser control do the following :
window.External.CSharpMethod('from html page to WPF');
Upvotes: 2