我使用下面的代码来处理反压的事件,但它不起作用
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?)
任何人都可以帮助我,或者指出正确的方向吗?
最佳答案
如果您尝试处理按下的特定键,您通常会收到所有这些事件作为单个 KeyPressed
事件或类似事件。
此外,在处理事件时,您实际上将处理程序添加到事件中,该事件有一个特定的委托(delegate)
,它应该为您指明正确的方向。
关于c# - 事件支持 WP 8.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29958070/