When our WPF application starts, Single Sign On is used to log in. To allow testers to simulate other users, we would like the Control button to hold at startup and open a login dialog.
This is what I use in a WPF application to check if the control key is held in the main window constructor. It uses System.Windows.Input.Keyboard
if ((Keyboard.Modifiers & ModifierKeys.Control) > 0) PromptForMarketSelection();
EDIT - Bug fixed by Coincoin
A universal solution would be p / invoke GetAsyncKeyState(VK_CONTROL) if you cannot find anything built into .NET.
GetAsyncKeyState(VK_CONTROL)
Take a look at this article that used Keys modifiers to find out what you're looking for.
Check out the following link ... scroll down to see Jeff Wan's answer.
How to determine the current key pressed?