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: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public char PasswordChar { get; set; }
/** @property */
public char get_PasswordChar ()

/** @property */
public void set_PasswordChar (char value)

public function get PasswordChar () : char

public function set PasswordChar (value : char)

<object PasswordChar="char" .../>

Property Value

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

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 example shows how to set the PasswordChar attribute of a PasswordBox element.

<PasswordBox
  Name="pwdBox" 
  MaxLength="64"
  PasswordChar="#"
  PasswordChanged="PasswordChangedHandler"  
/>

The following example shows how to set the PasswordChar property programmatically.

// Change the password masking character to a period.
pwdBox.PasswordChar = '.';

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2014 Microsoft