Example #1
0
        public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            if (sender is PasswordBox passwordBox)
            {
                //Remove any previous evens
                passwordBox.PasswordChanged -= PasswordBoxOnPasswordChanged;

                //If the caller set MonitorPassword to true...
                if (e.NewValue is bool flag && flag)
                {
                    HasTextProperty.SetValue(passwordBox);
                    //start listening out for password changes
                    passwordBox.PasswordChanged += PasswordBoxOnPasswordChanged;
                }
            }
        }
Example #2
0
 private void PasswordBoxOnPasswordChanged(object sender, RoutedEventArgs e)
 {
     HasTextProperty.SetValue((PasswordBox)sender);
 }