views:

764

answers:

2

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?

Thanks.

+1  A: 

If you use a MaskedTextBox and specify a passwordChar the .NET framework will automatically do this for you

ferrari fan
I believe MaskedTextBox is a WinForms control - I'm using WPF. I'd like to be able to continue using the PasswordBox because of its built-in security.
vg1890
A: 

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.

xan
This will do the trick! To detect CapsLock in the event handler, just check the boolean value of: Keyboard.IsKeyToggled(Key.CapsLock)
vg1890