

For information about modifying a control's style and template, see XAML styles. You can modify the default Style and ControlTemplate to give the control a unique appearance. IsPasswordRevealButtonEnabled is deprecated in Windows 10 and any value is ignored. Use the PasswordRevealMode property instead of the IsPasswordRevealButtonEnabled property. For more info and examples, see PasswordRevealMode and PasswordBox control guide.
#XAML PASSWORDBOX VALIDATION PASSWORD#
You can hide the password reveal button, or provide a custom UI to let the user reveal the password. When they let go of either key press, the password is hidden again. When the focus is in the PasswordBox and the password reveal button is visible, the user can press and hold Alt+F8 to reveal their password. Windows 10, version 1607, introduces a new keyboard shortcut for accessibility. If the PasswordBox loses focus and then regains focus, the button is not shown again unless the password is cleared and character entry starts over. Note that due to security reasons that button is shown only when the PasswordBox receives focus for the first time and a character is entered. When the user releases it, the password is automatically hidden again. By default, the PasswordBox has a built-in button that the user can press to display the password text.

The PasswordRevealMode property lets you customize the password viewing experience. Handle the PasswordChanged event to get the Password value while the user enters it.įor more info, see PasswordBox control guide. Use the Password property to get or set the content of the PasswordBox. You can specify this password character by setting the PasswordChar property. The text is not displayed while it is entered only password characters that mask the text are displayed. The user can enter a single line of non-wrapping text in a PasswordBox control.

PasswordBox lets a user enter a masked password.
#XAML PASSWORDBOX VALIDATION CODE#
StatusText.Text = "'Password' is not allowed as a password."įor more info, design guidance, and code examples, see Password box. If passwordBox.Password = "Password" Then Private Sub passwordBox_PasswordChanged(sender As Object, e As RoutedEventArgs) StatusText.Text = "'Password' is not allowed as a password." Private void passwordBox_PasswordChanged(object sender, RoutedEventArgs e) If it is, a message is displayed to the user. When the user enters text into this PasswordBox, it's checked to see if it's the literal value, "Password".

This example shows a PasswordBox control that demonstrates the Password property and the PasswordChanged event. Get the app from the Microsoft Store or get the source code on GitHub. The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Open the WinUI 2 Gallery app and see the PasswordBox in action Public sealed class PasswordBox : Control Public NotInheritable Class PasswordBox Public sealed class PasswordBox : Control / Ĭlass PasswordBox final : Control /// Ĭlass PasswordBox final : Control public ref class PasswordBox sealed : Control /// Represents a control for entering passwords.
