次の方法で共有


PasswordBox.PasswordChar プロパティ

定義

PasswordBoxのマスク文字を取得または設定します。

public:
 property char PasswordChar { char get(); void set(char value); };
public char PasswordChar { get; set; }
member this.PasswordChar : char with get, set
Public Property PasswordChar As Char

プロパティ値

ユーザーが PasswordBoxにテキストを入力したときにエコーするマスク文字。 既定値は行頭文字 (●) です。

次の例は、PasswordBox要素のPasswordChar属性を設定する方法を示しています。

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

次の例は、PasswordChar プロパティをプログラムで設定する方法を示しています。

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

注釈

テキストが PasswordBoxに入力されると、実際のパスワード自体ではなく、このプロパティで指定されたマスク文字がパスワード入力フィールドにエコーされます。 これにより、入力時にパスワードが何気ないオブザーバーに公開されるのを防ぐことができます。

依存関係プロパティ情報

品目 価値
識別子フィールド PasswordCharProperty
に設定されたメタデータ プロパティ true なし

適用対象