1

javascript函数我在HTML5的JavascriptSilverlight的)开发的Windows 8.1应用。我在硬件后退按钮功能stucked。从调用代码隐藏MainPage.xaml.cs中文件中的Windows应用程序

在MainPage.xaml.cs中代码隐藏文件,我想打电话从以下方法javascript函数:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) 
{ 
// Here i want to call a javascript function 
} 
+0

可能重复的[从Silverlight调用JavaScript函数] /问题/ 534208 /电话-A-JavaScript的功能从-的Silverlight) – matt

回答

1

下面是答案:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) 
{ 
    Browser.InvokeScript("functionName"); 
} 

和参数也可以从这里传递像这样:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) 
    { 
     Browser.InvokeScript("functionName","param1"); 
    } 
相关问题