PasswordBoxEdit Class

Represents a control allowing you to enter and manage passwords.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v20.1.dll

Declaration

public class PasswordBoxEdit :
    TextEditBase
Public Class PasswordBoxEdit
    Inherits TextEditBase

Remarks

PasswordBox_NullText

The PasswordBoxEdit control allows you to hide the characters and optionally limit the password's length.

TIP

The PasswordBoxEdit class inherits its features from the TextEditBase class.

Refer to the TextEditBase class description for information on derived features and API.

Create a PasswordBoxEdit

<Window ...
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">

<dxe:PasswordBoxEdit 
    ShowCapsLockWarningToolTip="True"
    NullValue="" 
    NullText="Please enter your password..." />

Use the Password property to get a password entered by an end user.

To respond to changing the editor's value, handle the BaseEdit.EditValueChanged event. To check the new value's validity, handle the BaseEdit.Validate event.

Password Char

Use the PasswordChar property to specify any character which is echoed in the password box.

PasswordBoxEdit PasswordChar

CapsLock Warning

If the Caps Lock is turned on and the mouse pointer rests over the password box editor, the editor can display a warning tooltip. Set the ShowCapsLockWarningToolTip property to true to display the CapsLock warning tooltip.

capslock warning tooltip

To provide custom content for the warning tooltip, use the CapsLockWarningToolTipTemplate property.

Password Strength and Requirements

You can restrict the password length typed by an end user via the TextEditBase.MaxLength property.

The password strength is automatically estimated and returned by the PasswordStrength property. To manually estimate password strength, handle the CustomPasswordStrength event. The event parameter allows you to obtain the text currently entered by an end user (PasswordStrengthEventArgs.Password) and specify the password strength (PasswordStrengthEventArgs.PasswordStrength).

<dx:ThemedWindow ...
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        dx:ThemeManager.Theme="Office2019Colorful">
    <Grid>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
            <dxe:PasswordBoxEdit x:Name="pwd" />
            <!-- Label content is bound to the PasswordBoxEdit's PasswordStrength property -->
            <Label Content="{DXBinding @e(pwd).PasswordStrength.ToString()}" Margin="10,0,0,0" />
        </StackPanel>
    </Grid>
</dx:ThemedWindow>

display password strength

See Also