Does anyone know how to implement the standard bubble message that warns users whenever Caps Lock is enabled and a password control has focus? Is this built into the .NET framework, or do I need to write my own class to do this?
This is an old question, and already answered, but I came across this same problem and I first started with Keyboard.IsKeyToggled(Key.CapsLock)
but that returned false
if Caps Lock was set prior to the application running. So I found another solution that works perfectly.
Console.CapsLock //is boolean and returns true if CapsLock is on
Absolutely brilliant and simple (it's in the mscorlib dll so you don't have to worry about unneeded dependencies either)
You could add a handler function to the PasswordChanged event handler and test for the value of the CapsLock key in that function. If found to be on, you could pop-up a message from there.
If you use a MaskedTextBox and specify a passwordChar the .NET framework will automatically do this for you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With