PasswordBox Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
[TemplatePartAttribute(Name="PART_ContentHost", Type=typeof(FrameworkElement))] public sealed class PasswordBox : Control
/** @attribute TemplatePartAttribute(Name="PART_ContentHost", Type=System.Windows.FrameworkElement) */ public final class PasswordBox extends Control
TemplatePartAttribute(Name="PART_ContentHost", Type=System.Windows.FrameworkElement) public final class PasswordBox extends Control
<PasswordBox .../>
Important: |
|---|
| PasswordBox has built-in handling for the bubbling MouseUp and MouseDown events. Consequently, custom event handlers that listen for MouseUp or MouseDown events from a PasswordBox will never be called. If you need to respond to these events, listen for the tunneling PreviewMouseUp and PreviewMouseDown events instead, or register the handlers with the HandledEventsToo argument (this latter option is only available through code). Do not mark the event handled unless you deliberately want to disable PasswordBox native handling of these events, and be aware that this has notable effects on the control's UI. |
The following example shows how to specify the handler method for the PasswordChanged event.
<PasswordBox Name="pwdBox" MaxLength="64" PasswordChar="#" PasswordChanged="PasswordChangedHandler" />
The following example shows the corresponding event handler. In this case, the event handler simply increments a counter.
private int pwChanges = 0; void PasswordChangedHandler(Object sender, RoutedEventArgs args) { // Increment a counter each time the event fires. ++pwChanges; }
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Important: