Пример #1
0
        public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //get caller
            var passwordBox = sender as PasswordBox;

            //make sure it is passwordBox
            if (passwordBox == null)
            {
                return;
            }

            //remove previous events
            passwordBox.PasswordChanged -= PasswordBox_PasswordChanged;

            //if true listen out
            if ((bool)e.NewValue)
            {
                //set default value

                HasTextProperty.SetValue(passwordBox);
                passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
            }
        }
Пример #2
0
 private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
 {
     HasTextProperty.SetValue((PasswordBox)sender);
 }