2015-04-30 102 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,应该指向正确的方向。