Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PasswordBox.PasswordChar Property

Gets or sets the masking character for the PasswordBox.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public char PasswordChar { get; set; }
<PasswordBox PasswordChar="char"/>

Property Value

Type: System.Char
A masking character to echo when the user enters text into the PasswordBox.
The default value is a bullet character (●).

Dependency property identifier field: PasswordCharProperty

When text is entered into a PasswordBox, the masking character specified by this property is echoed in the password input field, rather than the actual password itself. This helps prevent passwords from being exposed to casual observers when they are entered.

The following code snippet demonstrates the PasswordChar property. This example is part of a larger example available in the PasswordBox class overview.

Security noteSecurity Note:

Avoid hard-coding a password within your source code.


<TextBlock Text="PasswordChar demonstration" Margin="20,10,0,0"/>
<PasswordBox x:Name="MyPWBox2" Margin="20,10,0,0" Height="35" Width="200" Password="HelloWorld" HorizontalAlignment="Left"/>
<PasswordBox x:Name="MyPWBox3" Margin="20,10,0,0" Height="35" Width="200" Password="HelloWorld" PasswordChar="$" HorizontalAlignment="Left"/>


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft