PasswordBox::MaxLength Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the maximum length for passwords to be handled by this PasswordBox.

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

public:
property int MaxLength {
	int get();
	void set(int value);
}

Property Value

Type: System::Int32

An integer specifying the maximum length, in characters, for passwords to be handled by this PasswordBox.

A value of zero (0) means no limit.

The default value is 0 (no length limit).

This property only restricts passwords entered manually by the user; it has no effect on programmatic manipulation of the Password property.

Identifier field

MaxLengthProperty

Metadata properties set to true

None

The following example shows how to set the MaxLength attribute of a PasswordBox element.

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

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

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: