Esempio n. 1
0
        public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //Get the caller and make sure it is a PasswordBox
            if (!(sender is PasswordBox passwordBox))
            {
                return;
            }

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

            //If the caller set MonitorPassword to true, start listening
            if (!(bool)e.NewValue)
            {
                return;
            }
            HasTextProperty.SetValue(passwordBox);
            passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
        }
Esempio n. 2
0
 /// <summary>
 /// Fired when the password box password value changes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
 {
     //Set the attached HasText value
     HasTextProperty.SetValue((PasswordBox)sender);
 }