splash27
splash27

Reputation: 2107

How to reveal/hide characters in PasswordBox?

I need to create a checkbox that will reveal password characters in two PasswordBox controls (Password and Confirm Password respectively). So, when this checkbox is checked PasswordBox must show password instead of "*****". Actually, I'm asking about property (if it exists) that controls this behavior of PasswordBox. I didn't find it on MSDN (or didn't understand).

Upvotes: 0

Views: 2818

Answers (2)

Abbas
Abbas

Reputation: 14432

For Windows Phone 8.1 (not 8.0) there is the property IsPasswordRevealButtonEnabled.

Definition:

Gets or sets a value that specifies whether the visual UI of the PasswordBox includes a button element that toggles showing or hiding the typed characters.

XAML:

<PasswordBox IsPasswordRevealButtonEnabled="bool" />

C#:

public bool IsPasswordRevealButtonEnabled { get; set; }

Upvotes: 2

ad1Dima
ad1Dima

Reputation: 3195

You have to use TextBox to show characters. You can put them over your PasswordBoxes and bind Text to Password and Visibility to IsChecked of CheckBox

Upvotes: 1

Related Questions