0

I have a window that has to behave as normally as possible to the Windows 7 standard despite having ResizeMode set to CanMinimize.

I acknowledge the poor sense in this route, but it's one of the only ways I'm aware of of hosting non-WPF content (WinFormsHost, etc) in a chromeless/borderless parent window (As AllowsTransparency (the traditional way) would normally conflict with it (causing it to not render at all)).

With this in mind, I have written my own resize and gesture code for the window (snap to side, maximize when dragged to top, etc) and this all works brilliantly.

I would have the expected behavior the user gets from WinKey + Direction (Left and Right snap the window to Left or Right, while Up maximizes it and Down restores it to normal size) with no difficulty as well, however it seems the system swallows this particular combination before it even reaches the application. When directional OR windows keys are pressed, the events are triggered appropriately, but the combination just will not trigger it whatsoever.

So my question is thus: Is it possible to react to this combination in a relatively ordinary WPF application without inserting keyboard hooks into the system?

Thanks for your time.

4

1 回答 1

0

根据Gustavo Cavalcanti 对类似问题的回答找到解决方案。该应用程序现在正在捕获单个按键事件,并且我能够确定键盘状态并在按下箭头键时采取相应的行动(通过检查 LWin/RWin 和使用Keyboard.IsKeyDown的箭头)。

目前这是一个不错的解决方案,但它与 Windows 的正常功能不完全匹配,因为预计 Windows 会在用户按下箭头键而不是释放时移动/停靠。

都一样,总比没有好,开箱即用,额外代码最少,没有其他依赖项/库。仍然欢迎高级解决方案,我不会将此答案标记为解决方案,因为问题尚未得到全面解决。

于 2014-04-24T05:47:31.727 回答