如何处理Escape press(Metro应用程序) [英] How to handle Escape pressing (Metro apps)

查看:61
本文介绍了如何处理Escape press(Metro应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

我尝试按Escape键。我订阅了Window.Current.CoreWindow.KeyDown事件。如果它被打开,我会尝试关闭AppBar,反之亦然。但是当KeyDown事件被触发时,AppBar已经(并且始终)已经关闭。我的处理程序再次打开
。当我按下退出按钮时如何确定AppBar是打开/关闭?

I try to handle Escape pressing. I've subscribed on Window.Current.CoreWindow.KeyDown event. And there I try to close AppBar if it is opened and vice versa. But when KeyDown event is fired AppBar is already (and always) closed. And my handler opens it again. How to determine if AppBar is opened/closed when I'm pressing Escape button?

推荐答案

如果我正确理解了您的问题,您希望在按下Escape时切换AppBar的状态。   AppBar上有一个IsOpen属性,可用于切换其状态。

If I understand your question correctly, you are wanting to toggle the state of the AppBar when the Escape is pressed.   There is an IsOpen property on the AppBar that you can use to toggle its state.

if (e.Key == Windows.System。 VirtualKey 。逃生)

if (e.Key == Windows.System.VirtualKey.Escape)

{

myAppBar.IsOpen =!myAppBar.IsOpen;

myAppBar.IsOpen = !myAppBar.IsOpen;

}


这篇关于如何处理Escape press(Metro应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆