Now I am taking another form for login as follows: errormessage.Text = "You have Registered successfully.".SqlConnection con = new SqlConnection( "Data Source=TESTPURU Initial Catalog=Data User ID=sa Password=wintellect" ).errormessage.Text = "Confirm password must be same as password.".else if (passwordBox1.Password != passwordBoxConfirm.Password).errormessage.Text = "Enter Confirm password.".errormessage.Text = "Enter password.".string password = passwordBox1.Password.string lastname = textBoxLastName.Text.string firstname = textBoxFirstName.Text.errormessage.Text = "Enter a valid email.".errormessage.Text = "Enter an email.".private void Submit_Click( object sender, RoutedEventArgs e).private void button3_Click( object sender, RoutedEventArgs e).private void button2_Click( object sender, RoutedEventArgs e).private void Login_Click( object sender, RoutedEventArgs e).public partial class Registration : Window./// Interaction logic for Registration.xaml.Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question. SetPassword(passwordBox, passwordBox.Password) Private static void PasswordChanged(object sender, RoutedEventArgs e) Private static void Attach(DependencyObject sender, PasswordBox.PasswordChanged += PasswordChanged PasswordBox.Password = (string)e.NewValue PasswordBox.PasswordChanged -= PasswordChanged PasswordBox passwordBox = sender as PasswordBox Private static void OnPasswordPropert圜hanged(DependencyObject sender, Private static void SetIsUpdating(DependencyObject dp, bool value) Return (bool)dp.GetValue(IsUpdatingProperty) Private static bool GetIsUpdating(DependencyObject dp) Public static void SetPassword(DependencyObject dp, string value) Return (string)dp.GetValue(PasswordProperty) Public static string GetPassword(DependencyObject dp) Return (bool)dp.GetValue(AttachProperty) Public static bool GetAttach(DependencyObject dp) Public static void SetAttach(DependencyObject dp, bool value) Private static readonly DependencyProperty IsUpdatingProperty =ĭependencyProperty.RegisterAttached("IsUpdating", typeof(bool), Typeof(bool), typeof(PasswordHelper), new PropertyMetadata(false, Attach)) Public static readonly DependencyProperty AttachProperty =ĭependencyProperty.RegisterAttached("Attach", New FrameworkPropertyMetadata(string.Empty, OnPasswordPropert圜hanged)) Public static readonly DependencyProperty PasswordProperty =ĭependencyProperty.RegisterAttached("Password", There's an attached property based helper class here: The equivalent is Password, but I think you will find there's an issue in that it's not a dependency property. There is no XAML only solution however if that's what you are looking for. Pb.Tag = (!string.IsNullOrEmpty(pb.Password)).ToString() private void OnPasswordChanged(object sender, RoutedEventArgs e) You could handle the PasswordChanged event of the PasswordBox and set its Tag property to "True" or "False" depending on whether the Password property contains any characters and then check the value of the Tag property in the trigger. There is a Password property but you won't be able to use it like the Text property since it is not a dependency property.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |