Reputation: 6552
So in WPF it seems I can't create a TextBox with a password character and the PasswordBox I don't see a way to unhide the password.
I have tried the following that I use in WinForms on a TextBox in WPF and no luck. Is there any way to do this?
PasswordBox.PasswordChar = (char)0
Just to add some detail on what i'm doing that needs this. I have an application that contains many credentials for many different systems and devices. A user that needs access to these because I don't have a way to automatically send them to the device clicks a request button that logs the user having access to them and then displays it to the user.
I currently have them displayed in a messagebox but this doesn't allow the user to copy/paste crazy passwords if needed. Although I know that can be a security issue as well. Just trying to make it easy to use by the support staff.
Upvotes: 2
Views: 4117
Reputation: 7301
That ain't work, and this is good. That would be a security issue. You can bind to SecurePassword but not to Password because this is no Dependency Property.
But you can use a workaround: How to show characters for a few seconds in a WPF password box?
Be aware: If you store the password as string you will reveal the password for people looking at your running code.
Upvotes: 1
Reputation: 77304
No, there is not and for a good reason. If you really think you need this, you will need a password box, a textbox, a behaviour for binding to the passwordbox and then connect all those elements. In favor of a secure application, I would think twice about the ability to unprotect the password.
Upvotes: 1