public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            // Get the caller
            var passwordBox = sender as PasswordBox;

            // Make sure it is a PasswordBox object
            if (passwordBox == null)
            {
                return;
            }

            // Remove any previous events
            passwordBox.PasswordChanged -= PasswordBox_PasswordChanged;

            // If the caller set MonitorPassword to true...
            if ((bool)e.NewValue)
            {
                // Set default value
                HasTextProperty.SetValue(passwordBox);

                // Start listening out for password changes
                passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
            }
        }
 /// <summary>
 /// Fires when the <see cref="PasswordBox"/> password value is changed
 /// </summary>
 /// <param name="sender">The caller</param>
 /// <param name="e">Th event attached arguments</param>
 private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
 {
     HasTextProperty.SetValue((PasswordBox)sender);
 }