private static void IsPasswordBoundProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { var PasswordBox = o as PasswordBox; if (PasswordBox == null) { throw new ArgumentException("Type mismatch", "o"); } var Value = (bool)e.NewValue; var Listener = GetPasswordValueWeakEventListener(PasswordBox); if (Value) { if (Listener == null) { Listener = new PasswordChangedEventListener(); } SetPasswordValueWeakEventListener(PasswordBox, Listener); PasswordChangedEventManager.AddListener(PasswordBox, Listener); } else if (Listener != null) { SetPasswordValueWeakEventListener(PasswordBox, null); PasswordChangedEventManager.RemoveListener(PasswordBox, Listener); } }
private static void IsPasswordBoundProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { var PasswordBox = o as PasswordBox; if (PasswordBox == null) throw new ArgumentException("Type mismatch", "o"); var Value = (bool)e.NewValue; var Listener = GetPasswordValueWeakEventListener(PasswordBox); if (Value) { if (Listener == null) Listener = new PasswordChangedEventListener(); SetPasswordValueWeakEventListener(PasswordBox, Listener); PasswordChangedEventManager.AddListener(PasswordBox, Listener); } else if (Listener != null) { SetPasswordValueWeakEventListener(PasswordBox, null); PasswordChangedEventManager.RemoveListener(PasswordBox, Listener); } }