If you’re writing a WPF application and need to find the state of the Num Lock, Caps Lock, or Scroll Lock keys, you can use the Keyboard.IsToggled method (introduced in .NET 3.0):
|
|
Add this using
directive to the top of your class, if it’s not already there:
|
|
Internally, the IsToggled() method checks to see whether or not a KeyStates.Toggled
flag is set for the specified key.
|
|