Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect plus key in wpf?

Tags:

c#

wpf

keyboard

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.

like image 246
Abdulsalam Elsharif Avatar asked Oct 07 '13 00:10

Abdulsalam Elsharif


2 Answers

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.

like image 172
Nikhil Agrawal Avatar answered Nov 06 '22 17:11

Nikhil Agrawal


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.

like image 4
Millie Smith Avatar answered Nov 06 '22 15:11

Millie Smith