PasswordBox.MaxLength プロパティ

定義

この PasswordBox によって処理されるパスワードの最大長を取得または設定します。

public:
 property int MaxLength { int get(); void set(int value); };
public int MaxLength { get; set; }
member this.MaxLength : int with get, set
Public Property MaxLength As Integer

プロパティ値

Int32

この PasswordBox によって処理されるパスワードの最大長 (文字数) を指定する整数。

0 の値は、制限がないことを意味します。

既定値は 0 (長さ制限なし) です。

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

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

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

// Set the new maximum input length for passwords to 128 characters.
pwdBox.MaxLength = 128;
' Set the new maximum input length for passwords to 128 characters.
pwdBox.MaxLength = 128

注釈

このプロパティは、ユーザーが手動で入力したパスワードのみを制限します。プロパティのプログラムによる操作 Password には影響しません。

依存プロパティ情報

識別子フィールド MaxLengthProperty
メタデータのプロパティが次に設定されている true なし

適用対象