Skip to main content
A newer version of this page is available. .

PasswordEdit Class

An editor that allows users to enter and manage passwords.

Namespace: DevExpress.XamarinForms.Editors

Assembly: DevExpress.XamarinForms.Editors.dll

NuGet Package: DevExpress.XamarinForms.Editors

Declaration

public class PasswordEdit :
    TextEditBase

Remarks

PasswordEdit is a single-line text editor that can hide entered characters.

It initially displays the input box and the default show/hide password icon.

You can also add the following optional elements:

  1. Label
  2. Placeholder
  1. Custom Icon
  2. Character Counter
  1. Help Text
  2. Error Message

Input Text

Use the Text property to obtain or set the password entered in the editor.

To manage the cursor position and text selection, use the CursorPosition and SelectionStart/SelectionLength properties.

The Keyboard property specifies the type of the keyboard used to edit text in the editor. The ReturnType property allows you to change the appearance of the return button on the keyboard. When a user taps this button, the Completed event occurs.

Use the following properties to change the input text appearance and alignment:

Property

Description

TextColor / DisabledTextColor

Specify the text color for different states of the editor.

TextFontSize
TextFontFamily
TextFontAttributes

Configure the font settings.

TextHorizontalAlignment

Gets or sets the horizontal alignment of text entered in the editor.

Label

A label is the editor’s input prompt string (LabelText). Editors display this string inside the edit box (when the editor is empty and not focused) or at the top of the editor.

To pin the label to the top edge of the editor box, set the IsLabelFloating property to false.

To customize the label’s appearance settings, use the following properties:

Property

Description

LabelColor / FocusedLabelColor
DisabledLabelColor / ErrorColor

Specify the label color for each state of the password-edit-label editor.

LabelFontSize
TextFontFamily
TextFontAttributes

Configure the label font settings.

Placeholder

A placeholder (PlaceholderText) is the input prompt string displayed within the text box when the editor is empty.

To specify the placeholder text color, use the PlaceholderColor property.

Help Text and Error Message

You can display the following labels:

  • HelpText - additional guidance about the password input displayed under the editor box.
  • ErrorText - an error message that can indicate an incorrect password.
    This text is displayed instead of help text below the editor box when an error is detected (HasError is true).

The BottomTextTopIndent property specifies the indent between the editor’s bottom border and help or error text.
The ReserveBottomTextLine property allows you to reserve space under the editor box to show one line of text there when it is required (for example, to show an error message when an incorrect password is identified).

To specify the color and font attributes for the help and error text, use the following properties:

Property

Description

HelpTextColor / DisabledHelpTextColor

Specify the help text color for different states of the text editor.

ErrorColor

Specify the error message text color.

BottomTextFontSize
BottomTextFontFamily
BottomTextFontAttributes

Configure the font settings.

Icons

The password editor can display icons within its box.

  • Show/hide password icon - toggles the visibility of characters entered in the editor.
  • Clear icon - removes text entered in the editor.
  • Error icon - appears in the error state (HasError is true).
  • Custom icons - can be shown on the left or right within the box.

Use the following members to manage the editor’s icons:

Icon

Property

Description

Password Icon

PasswordIconVisibility

Specifies the hide/show password icon visibility.

ShowPasswordIcon / HidePasswordIcon

Allows you to replace the default password icon with a custom icon.

Clear Icon

ClearIconVisibility

Specifies when the clear icon is displayed.

ClearIcon

Specifies the clear icon image.

ClearIconClicked / ClearIconCommand

Allows you to assign an additional action to the clear icon.

Error Icon

ErrorIcon

Specifies the error icon image.

ErrorIconClicked / ErrorIconCommand

Allows you to perform an action when a user clicks the error icon.

Custom Icons

StartIcon / EndIcon

Specifies a custom icon.

StartIconClicked / StartIconCommand
EndIconClicked / EndIconCommand

Allows you to perform an action when a user clicks a custom icon.

IsStartIconVisible / IsEndIconVisible

Specifies whether an icon is visible.

Common

IconColor / DisabledIconColor

Specifies icon colors for different states of the password editor.

IconIndent

Gets or sets the distance between an icon and input text (affix).

IconSpacing

Gets or sets the distance between icons.

IconVerticalAlignment

Gets or sets the vertical alignment of icons.

Character Counter

If you limit input string length (MaxCharacterCount), the editor displays a character counter under the text box.

Use the MaxCharacterCountOverflowMode property to prevent users from entering more characters than MaxCharacterCount.

To specify the space between the character counter and help text, use the CharacterCounterIndent property.

Editor Appearance

Use the following properties to change the appearance of the editor box and its borders:

Property

Description

BorderColor
DisabledBorderColor
FocusedBorderColor

Specify the border color for each state of the password editor.

ErrorColor

Gets or sets the color of editor box borders, label and error message shown in case of input error.

BorderThickness
DisabledBorderThickness
FocusedBorderThickness

Specify the border thickness for each state of the password editor.

CornerMode

Gets or sets whether editor box corners are rounded or cut.

CornerRadius

Specifies the radius of the editor box corners.

BackgroundColor
DisabledBackgroundColor

Specify the editor box fill color.

BoxPadding

Gets or sets the amount of space between borders of the edit box and its content.

Implements

Xamarin.Forms.IAnimatable
Xamarin.Forms.IViewController
Xamarin.Forms.IVisualElementController
Xamarin.Forms.Internals.IGestureController
Xamarin.Forms.IElementController

Inheritance

Object
Xamarin.Forms.BindableObject
Xamarin.Forms.Element
Xamarin.Forms.NavigableElement
Xamarin.Forms.VisualElement
See Also