c# - Multiple keys with WPF KeyDown event -
i'm working wpf keydown event (keyeventargs windows.input). need recognize when user pressed f1 alone , ctrl+f1.
private void window_keydown(object sender, keyeventargs e) { if (e.key==key.f1 && keyboard.iskeydown(key.leftctrl)) { messagebox.show("ctrlf1"); } if (e.key == key.f1 && !keyboard.iskeydown(key.leftctrl)) { messagebox.show("f1"); } }
my problem when press ctrl+f1 plain f1 messagebox fire too. tried add e.handled ctrl+f1 case, doesn't help.
use:
else if.....
in case both options fired, because press f1 key in both cases.
Comments
Post a Comment