Ejemplo n.º 1
0
        public override void OnValuePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //Get the calles
            var passwordBox = sender as PasswordBox;

            if (passwordBox == null)
            {
                return;
            }

            //Remove prevoius event
            passwordBox.PasswordChanged -= PasswordBox_PasswordChanged;

            //Start listening if MonitorPassword is set to true
            if ((bool)e.NewValue)
            {
                //Set default value
                HasTextProperty.SetValue(passwordBox);
                passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
            }
        }
Ejemplo n.º 2
0
 private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
 {
     HasTextProperty.SetValue((PasswordBox)sender);
 }