2014-09-19 50 views
0

我想停止瀏覽器導航,當我點擊button.I嘗試在下面的方法,但它沒有奏效。如何停止瀏覽器在csharp中導航windowsphone

private void webBrowser1_Navigating(object sender, NavigatingEventArgs e) 
    { 
     button2.Click += new RoutedEventHandler((object caller,System.Windows.RoutedEventArgs f) => 
     { 
      e.Cancel = true; 
     }); 
    } 

回答

0

如果你想阻止瀏覽器導航,你可以嘗試這樣的嘗試這種單

private void webBrowser_Navigating(object sender, NavigatingEventArgs e) 
    { 
     stop.IsEnabled=true; 
     stop.Click += new RoutedEventHandler((object caller, System.Windows.RoutedEventArgs f) => 
     { 
      stopPressed = true; 
     }); 

     if (stopPressed == true) 
      e.Cancel = true; 
    } 
0

 private void stop_Tap(object sender, System.Windows.Input.GestureEventArgs e) 
     { 
      MiniBrowser.InvokeScript("eval", "document.execCommand('Stop');"); 
     }