by default, the password stored in a PasswordBox is hidden behind a masking character. This can be changed from the default, a caret, to another character using PasswordBox.PasswordChar.
My question is this: Is there a way to remove the masking function altogether, in other words make the password visible?
Obviously your first thought might be to use a plain text entry field, however, the user has the ability to show or hide repeatedly, at will. While using this solution I could replace the password with carets and store the real password in a variable, and then replace it with the real password again if the user wants it visible, I don’t like the idea because it makes for a lot of somewhat messy code.
Any ideas would be much appreciated. Thank you.
I would guess that, for security reasons, the
PasswordBoxcontrol does not allow this. Another way to do it would be to have thePasswordBoxcontrol and a hidden plain text box. When the user chooses to show the password you copy the string to the text box and show that and hide the PasswordBox. Obscuring the password again is just the opposite process.