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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -