如何在WPF中绑定Ctrl和数字键盘/(正斜杠)? [英] How can I bind Ctrl and the Number Pad / (forward slash) in WPF?

查看:54
本文介绍了如何在WPF中绑定Ctrl和数字键盘/(正斜杠)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够对 Ctrl +/进行键盘绑定.但不是与?(在主键盘上)相同的键上的/.我想在/的数字键盘上执行此操作.

I want to be able to do a KeyBinding on Ctrl+/. But not the / that is on the same key as the ? (on the main keyboard). I want to do it on the number pad key of /.

要使其与主键盘配合使用,请执行以下操作:

To make it work with the main keyboard / this works:

<KeyBinding Command="{Binding ElementName=window, DataContext.KeyBindingCommand}"
                      CommandParameter="{Binding Gesture, RelativeSource Self}}"
                      Gesture="CTRL+Question"

它之所以使用Question,是因为它在按下控件时会得到偏移的值(我想).

It uses Question because it gets the shifted value when control is pressed (I guess).

但这不适用于小键盘的/键.

But that does not work for the numpad / key.

任何人都知道推荐答案

原来的键名是 Divide .进行了更多搜索.

Turns out the key name is Divide. Took just a bit more searching.

这篇关于如何在WPF中绑定Ctrl和数字键盘/(正斜杠)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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