2015-04-30 111 views
2

我用下面的代碼操縱事件backpressed,但它不工作事件backpressed WP 8.1

private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e) 
    { 
     Frame frame = Window.Current.Content as Frame; 
     if (frame == null) 
     { 
      return; 
     } 

     if (frame.CanGoBack) 
     { 
      frame.GoBack(); 
      e.Handled = true; 
     } 

它返回此錯誤:

Error 1 The type or namespace name 'BackPressedEventArgs' could not be found (are you missing a using directive or an assembly reference?)

誰能幫助我,或點我在正確的方向?

回答

1

如果您嘗試處理某個特定的按鍵,通常會將這些全部視爲單個事件或事件。

此外,在處理事件時,您實際上會將事件處理程序添加到事件中,該事件具有特定的delegate,應該指向正確的方向。