title: Detecting the user pressing F10 in WPF
body: <p>My WPF application has behaviour triggered by the functions keys (<kbd>F1</kbd>-<kbd>F12</kbd>).</p>
  
  <p>My code is along these lines:</p>
  
  <pre><code>private void Window_KeyDown(object sender, KeyEventArgs e)
  {
      switch (e.Key)
      {
          case Key.F1:
          ...
          case Key.F2:
          ...
      }
  }
  </code></pre>
  
  <p>This works for all F-keys except <kbd>F10</kbd>. Debugging, I find that <code>e.Key == Key.System</code> when the user presses <kbd>F10</kbd>.</p>
  
  <p>In the enum definition, <code>F10 = 99</code> and <code>System = 156</code>, so I can rule out it being a duplicate enum value (like <code>PageDown = Next = 20</code>).</p>
  
  <p>So, how do I tell when the user presses <kbd>F10</kbd>?</p>
  
  <p>Is it safe to check for <code>Key.System</code> instead? This feels a little dirty - might it be possible that <code>Key.System</code> would ever result from some other key being pressed? Or is there some setting somewhere that will make <kbd>F10</kbd> report as <code>Key.F10</code>?</p>