Skip to content

Instantly share code, notes, and snippets.

@aaronchiang
Created April 21, 2015 05:48
Show Gist options
  • Save aaronchiang/4aec7a59db9dbffcda51 to your computer and use it in GitHub Desktop.
Save aaronchiang/4aec7a59db9dbffcda51 to your computer and use it in GitHub Desktop.
public static string GetKeyDownString(KeyEventArgs args)
{
var value = "";
if ((Keyboard.Modifiers & ModifierKeys.Control) > 0)
{
value += "Ctrl+";
}
if ((Keyboard.Modifiers & ModifierKeys.Alt) > 0)
{
value += "Alt+";
}
if ((Keyboard.Modifiers & ModifierKeys.Shift) > 0)
{
value += "Shift+";
}
if ((Keyboard.Modifiers & ModifierKeys.Alt) > 0)
{
return value + args.SystemKey;
}
else
{
return value + args.Key;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment