Catch Alt + other key shortcut
<p>I have to catch user's input to send a shortcut to my WPF application.<br>I found on internet that I have to do something like this: <br> <strong>Catch when a key is pressed:</strong><br></p>
<pre><code>void keyDown(object sender, KeyEventArgs e)
{
    if (Keyboard.Modifiers.HasFlag(Modifiers.Shift))
        KeyPressed.SetShift(true);
    if (Key.Shift != e.Key &amp;&amp; Key.LeftAlt != e.Key &amp;&amp; ....) 
        KeyPressed.SetKey(e.Key);
}
</code></pre>
<p>where KeyPressed is a class with static boolean variables to catch if <kbd>⇧Shift</kbd>, <kbd>Alt</kbd> or <kbd>Ctrl</kbd> and another key are pressed (with <kbd>Alt</kbd> and <kbd>Ctrl</kbd> instead of <kbd>⇧Shift</kbd> in the <code>if</code> clause). The second <code>if</code> is to catch a key different from <kbd>Alt</kbd>, <kbd>⇧Shift</kbd>, Control for the shortcut. For example, for the shortcut <kbd>Alt</kbd>+<kbd>C</kbd> we have:</p>
<ol>
<li><code>KeyPressed.Shift = false;</code></li>
<li><code>KeyPressed.Alt = true;</code></li>
<li><code>KeyPressed.Ctrl = false;</code></li>
<li><code>KeyPressed.key = Key;</code></li>
</ol>
<p>Where the last element is of type <code>System.Window.Input.Key</code>.<br><strong>Catch when a key is released:</strong><br></p>
<pre><code>void keyUp(object sender, KeyEventArgs e)
{ 
    if (KeyPressed.getShift()) 
        this.textField.Text += &quot;+Shift&quot;;
    if (KeyPressed.getKeyCode())
        this.textField.Text += &quot;+&quot; + KeyPressed.k.toString();

    KeyPressed.SetShift(false);
}
</code></pre>
<p>and here simply I append to a textField the input received, after that I set all keys to false to catch the next shortcut correctly. <br><br>This code works fine for all shortcuts like <kbd>Ctrl</kbd>+<kbd>A</kbd>, <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd>, <kbd>⇧Shift</kbd>+<kbd>L</kbd>, <kbd>Alt</kbd>, <strong>but when I press the shortcut like</strong> <kbd>Alt</kbd>+<kbd>V</kbd><strong>, it catchs only</strong> <kbd>Alt</kbd><strong>, not the other key.</strong></p>
<p>How can I manage this? Is there a way to handle shortcuts in a better manner?</p>