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

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -