private static void OnPasswordPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            if (!(sender is PasswordBox passwordBox))
            {
                return;
            }
            passwordBox.PasswordChanged -= PasswordBoxOnPasswordChanged;

            if ((bool)e.NewValue != true)
            {
                return;
            }
            FlagHasTextAttachedProperty.SetHasText(passwordBox, false);
            passwordBox.PasswordChanged += PasswordBoxOnPasswordChanged;
        }
Ejemplo n.º 2
0
        private static void PasswordBoxOnPasswordChanged(object sender, RoutedEventArgs e)
        {
            var pwbPassword = sender as PasswordBox;

            FlagHasTextAttachedProperty.SetHasText(pwbPassword, pwbPassword?.Password.Length > 0);
        }