public static void OnIsEyeVisiblePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PassowrdBox pb = d as PassowrdBox; bool value = (bool)e.NewValue; if (!value) { pb.tbtnEye.IsChecked = false; } pb.tbtnEye.Visibility = value ? Visibility.Visible : Visibility.Collapsed; }
public static void OnPasswordPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PassowrdBox pb = d as PassowrdBox; string newValue = string.Format("{0}", e.NewValue); if (pb.IsEyeVisible) { if (pb.txtUserPwd.Text != newValue) { pb.txtUserPwd.Text = newValue; pb.pbBox.Password = newValue; } } else { if (pb.pbBox.Password != newValue) { pb.txtUserPwd.Text = newValue; pb.pbBox.Password = newValue; } } }
public static void OnMaxLengthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PassowrdBox pb = d as PassowrdBox; pb.txtUserPwd.MaxLength = pb.pbBox.MaxLength = (int)e.NewValue; }