Class
RadPasswordBox

Represents a password input control that allows users to enter passwords securely. This control masks the input with a specified character (default is a bullet character '●'), and provides options to show the password through a button that toggles visibility. It also supports password-related events, including notifying when the password changes. The secure password is stored using SecureString to protect sensitive data against memory inspection. Additional features include customizable button content, and visibility controls for the password display button.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.dll

Syntax:

cs-api-definition
[TelerikToolboxCategory("Input")]
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public class RadPasswordBox : RadWatermarkTextBox

Inheritance: objectRadWatermarkTextBoxRadPasswordBox

Inherited Members RadWatermarkTextBox.LabelPropertyRadWatermarkTextBox.LabelStylePropertyRadWatermarkTextBox.KeepLabelFloatedPropertyRadWatermarkTextBox.HasLabelPropertyRadWatermarkTextBox.IsLabelFloatedPropertyRadWatermarkTextBox.WatermarkTemplatePropertyRadWatermarkTextBox.WatermarkContentPropertyRadWatermarkTextBox.CurrentTextPropertyRadWatermarkTextBox.SelectionOnFocusPropertyRadWatermarkTextBox.WatermarkBehaviorPropertyRadWatermarkTextBox.ReadOnlyBackgroundPropertyRadWatermarkTextBox.DisabledBackgroundPropertyRadWatermarkTextBox.AdditionalContentPropertyRadWatermarkTextBox.AdditionalContentTemplatePropertyRadWatermarkTextBox.IsWatermarkVisiblePropertyRadWatermarkTextBox.OnPropertyChanged(DependencyPropertyChangedEventArgs)RadWatermarkTextBox.OnInitialized(EventArgs)RadWatermarkTextBox.EndInit()RadWatermarkTextBox.LabelRadWatermarkTextBox.LabelStyleRadWatermarkTextBox.KeepLabelFloatedRadWatermarkTextBox.HasLabelRadWatermarkTextBox.IsLabelFloatedRadWatermarkTextBox.WatermarkContentRadWatermarkTextBox.WatermarkTemplateRadWatermarkTextBox.CurrentTextRadWatermarkTextBox.IsWatermarkVisibleRadWatermarkTextBox.WatermarkBehaviorRadWatermarkTextBox.ReadOnlyBackgroundRadWatermarkTextBox.DisabledBackgroundRadWatermarkTextBox.SelectionOnFocusRadWatermarkTextBox.AdditionalContentRadWatermarkTextBox.AdditionalContentTemplate

Constructors

RadPasswordBox()

Initializes a new instance of the RadPasswordBox class.

Declaration

cs-api-definition
public RadPasswordBox()

Fields

IsPasswordVisibleProperty

Identifies the IsPasswordVisible dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsPasswordVisibleProperty

Field Value

DependencyProperty

PasswordChangedEvent

Identifies the PasswordChanged routed event.

Declaration

cs-api-definition
public static readonly RoutedEvent PasswordChangedEvent

Field Value

RoutedEvent

PasswordCharProperty

Identifies the PasswordChar dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty PasswordCharProperty

Field Value

DependencyProperty

ShowPasswordButtonContentProperty

Identifies the ShowPasswordButtonContent dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ShowPasswordButtonContentProperty

Field Value

DependencyProperty

ShowPasswordButtonContentTemplateProperty

Identifies the ShowPasswordButtonContentTemplate dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ShowPasswordButtonContentTemplateProperty

Field Value

DependencyProperty

ShowPasswordButtonVisibilityProperty

Identifies the ShowPasswordButtonVisibility dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ShowPasswordButtonVisibilityProperty

Field Value

DependencyProperty

Properties

IsPasswordVisible

Gets value indicating whether the actual password is currently displayed.

Declaration

cs-api-definition
public bool IsPasswordVisible { get; }

Property Value

bool

Password

Gets or sets the current password as a string representation.

Declaration

cs-api-definition
public string Password { get; set; }

Property Value

string

PasswordChar

Gets or sets the masking character for RadPasswordBox. The default value is a bullet character (●).

Declaration

cs-api-definition
public char PasswordChar { get; set; }

Property Value

char

SecurePassword

Gets the current password as a SecureString.

Declaration

cs-api-definition
public SecureString SecurePassword { get; }

Property Value

SecureString

ShowPasswordButtonContent

Gets or sets the content to be shown in the button used to display the password at runtime.

Declaration

cs-api-definition
public object ShowPasswordButtonContent { get; set; }

Property Value

object

ShowPasswordButtonContentTemplate

Gets or sets the template for presenting the content in the button used to display the password at runtime.

Declaration

cs-api-definition
public DataTemplate ShowPasswordButtonContentTemplate { get; set; }

Property Value

DataTemplate

ShowPasswordButtonVisibility

Gets or sets value indicating whether the button used to display the password should be visible. The default value is Auto.

Declaration

cs-api-definition
public ShowPasswordButtonVisibilityMode ShowPasswordButtonVisibility { get; set; }

Property Value

ShowPasswordButtonVisibilityMode

Methods

Clear()

Clears the current Password.

Declaration

cs-api-definition
public void Clear()

HandleClear()

Called when the Clear command is invoked.

Declaration

cs-api-definition
protected override void HandleClear()

Overrides RadWatermarkTextBox.HandleClear()

HandleKeyDown(Key)

Contains the logic for handling the preview key down event of RadPasswordBox.

Declaration

cs-api-definition
protected virtual bool HandleKeyDown(Key key)

Parameters

key

Key

The key that has been pressed.

Returns

bool

True if the KeyDown event should be handled, otherwise false.

MeasureOverride(Size)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the System.Windows.FrameworkElement-derived class.

Declaration

cs-api-definition
protected override Size MeasureOverride(Size constraint)

Parameters

constraint

Size

A maximum Size to not exceed.

Returns

Size

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call .

Declaration

cs-api-definition
public override void OnApplyTemplate()

Overrides RadWatermarkTextBox.OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific System.Windows.Automation.Peers.AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

Declaration

cs-api-definition
protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

Overrides RadWatermarkTextBox.OnCreateAutomationPeer()

OnDrop(DragEventArgs)

Invoked when an unhandled System.Windows.DragDrop.DragEnter attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

Declaration

cs-api-definition
protected override void OnDrop(DragEventArgs e)

Parameters

e

DragEventArgs

The System.Windows.DragEventArgs that contains the event data.

OnPasswordChanged()

Called when the Password changes and raises the PasswordChanged event.

Declaration

cs-api-definition
protected virtual void OnPasswordChanged()

OnPreviewKeyDown(KeyEventArgs)

Virtual method reporting a key was pressed.

Declaration

cs-api-definition
protected override void OnPreviewKeyDown(KeyEventArgs e)

Parameters

e

KeyEventArgs

OnPreviewTextInput(TextCompositionEventArgs)

Virtual method reporting text composition.

Declaration

cs-api-definition
protected override void OnPreviewTextInput(TextCompositionEventArgs e)

Parameters

e

TextCompositionEventArgs

Events

PasswordChanged

Occurs when the value of the Password property changes.

Declaration

cs-api-definition
[SRCategory("Behavior")]
public event RoutedEventHandler PasswordChanged

Event Value

RoutedEventHandler