Ejemplo n.º 1
0
        private static void AddInfoTextAdorner(PasswordBox passwordBox)
        {
            InfoTextAdorner    adorner          = null;
            Action             updateVisibility = () => adorner.UpdateVisibility(passwordBox.SecurePassword == null || passwordBox.SecurePassword.Length == 0);
            RoutedEventHandler handler          = delegate { updateVisibility(); };
            Action             disposeAction    = () => passwordBox.PasswordChanged -= handler;

            adorner = new InfoTextAdorner(passwordBox, disposeAction);
            passwordBox.PasswordChanged += handler;
            updateVisibility();
            AddAdorner(passwordBox, adorner);
        }
Ejemplo n.º 2
0
        private static void AddInfoTextAdorner(TextBox textBox)
        {
            InfoTextAdorner         adorner          = null;
            Action                  updateVisibility = () => adorner.UpdateVisibility(string.IsNullOrEmpty(textBox.Text));
            TextChangedEventHandler handler          = delegate { updateVisibility(); };
            Action                  disposeAction    = () => textBox.TextChanged -= handler;

            adorner              = new InfoTextAdorner(textBox, disposeAction);
            textBox.TextChanged += handler;
            updateVisibility();
            AddAdorner(textBox, adorner);
        }