简体   繁体   中英

How to detect plus key in wpf?

I know i can use below code to determine the Enter key in keyboard

if (e.Key == Key.Return) { // do something }

But i want to know what is the code for "+" and "-"?

Can anyone help me please.

There are two sets. One in the keyboard side and the other in the keypad side.

For keboard use Key.OemPlus and Key.OemMinus and for keypad one use Key.Add and Key.Subtract .

The entire list of keys is here: http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx

OemPlus and OemMinus are correct, like Nikhil said.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM