使用Wpf中的快捷键打开一个窗口 [英] Open a window using shortcut key in Wpf

查看:60
本文介绍了使用Wpf中的快捷键打开一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请告诉我如何通过指定快捷键打开现有窗口。



例如如果我按 Ctrl + S 那么它应该打开settings.xaml窗口。



请告诉我怎么做

解决方案

您好,



您需要使用InputBindings和KeyBinding类,如下所示:



< window.inputbindings> 
< keybinding command = ApplicationCommands.Open >
Gesture = CTRL + R />
< / 键绑定 > < / window.inputbindings >





另外,这里有一篇文章可以帮到你:http://stackoverflow.com/questions/1319425/application-level -shortcut密钥合WPF。


Hi all

Please tell me how to open an existing window by assigning shortcut key.

e.g. if i press Ctrl+S then it should open settings.xaml window.

Please tell me how to do this

解决方案

Hello,

You need to use the InputBindings and KeyBinding classes, as following:

<window.inputbindings>
 <keybinding command="ApplicationCommands.Open">
       Gesture="CTRL+R" />
</keybinding></window.inputbindings>



Also, here's an article to help you out: http://stackoverflow.com/questions/1319425/application-level-shortcut-keys-in-wpf.


这篇关于使用Wpf中的快捷键打开一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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