PasswordChanged Event
Collapse the table of content
Expand the table of content

PasswordBox.PasswordChanged Event

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Occurs when the value of the Password property changes.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public event RoutedEventHandler PasswordChanged
<PasswordBox PasswordChanged="eventhandler"/>

The PasswordChanged event is raised even if the Password property is reset to the same text.

The PasswordChanged event cannot be bubbled or cancelled.

The following code snippets display a password box and a read-only text box. As you type a password in the password box, the text is displayed in the read-only text box. This example is part of a larger example available in the PasswordBox class overview.


<TextBlock Text="Type password here" Margin="20,10,0,0"/>
<PasswordBox x:Name="MyPWBox1" Margin="20,10,0,0" PasswordChanged="MyPWBox1_PasswordChanged" 
             MaxLength="8" Height="70" Width="200" HorizontalAlignment="Left" />
<TextBlock Text="Password" Margin="20,10,0,0"/>
<TextBox x:Name="ReadOnlyTB" Margin="20,10,0,0" HorizontalAlignment="Left" 
         IsReadOnly="True" Height="70" Width="200" />



private void MyPWBox1_PasswordChanged(object sender, RoutedEventArgs e)
{
    ReadOnlyTB.Text = MyPWBox1.Password;
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft