RepositoryItemTextEdit.PasswordChar Property
Gets or sets the password character that appears instead of actual characters.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
[DefaultValue('\0')]
[DXCategory("Behavior")]
public virtual char PasswordChar { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Char | '\0' | A character that appears instead of actual characters. |
Remarks
You can mask the actual users’ input in a text editor in two ways:
Set the RepositoryItemTextEdit.UseSystemPasswordChar property to true. An editor will mask its text as follows:
Set the PasswordChar property to any valid character. This character will mask the editor’s text.
For instance, if the PasswordChar property is set to “*”, an editor will look as follows:
Text editors ignore the PasswordChar property if their RepositoryItemMemoEdit.UseSystemPasswordChar property is set to true.
Users cannot copy or cut text from an editor in password mode; the TextEdit.Cut and TextEdit.Copy methods will do nothing.
The MemoEdit and MemoExEdit editors, and editors without text input, do not support input masks.
The code sample below illustrates how to turn on/off the password mask.
buttonEdit1.ButtonClick += ButtonEdit1_ButtonClick;
private void ButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit edit = sender as ButtonEdit;
edit.Properties.PasswordChar = (edit.Properties.PasswordChar == '*') ? '\0' : '*';
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PasswordChar property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.