javascriptasp.net.netxbap

Call javascript function from WPF browser application (xbap)


I am loading my xbap app into iFrame in a .aspx page. On button click in xbap application I want to call a JavaScript function which is in a page where xbap is loaded.


Solution

  • I have found the answer, you have to do something like this in your xbap when you call your javascript function

    dynamic script = BrowserInteropHelper.HostScript;
    script.document.javaScriptFunction();
    

    and your javascript function looks like this

    document.javaScriptFunction = function (){ your code here }
    

    This method is working for all version of IE.