SeePwd.AddHandler(Button.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.SeePwd_MouseLeftButtonDown), true) When the page of the program is initialized AddHandler Method. In the initialized function UIElement Of AddHandler Method, Explicitly add this event. therefore, If you must use this event, You need to use. also, Control's own Click event, Is equivalent to MouseLeftButtonDown Event suppression (Supress) It fell off, Transformed into Click event. Control captured MouseLeftButtonDown After the event, The event will be “Handled” Set to True, This property is used in event routing, When a control gets a RoutedEvent, Will detect Handled Is it true, by true Then ignore the event. ![]() Looked at some information, Only then did I know that this is a question of design principle. If you write normally, The program cannot respond to this event, After hitting the breakpoint, I found that I didn't leave the event at all. Public void ButtonDown(PasswordBox pwd, TextBox txt) Public void ButtonUp(PasswordBox pwd, TextBox txt) The specific code is encapsulated into a tool class Private void SeePwd_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) Private void SeePwd_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) ![]() The code is as follows // Press the small eye button and talk about the event Principle : By lifting and pressing the eye button, Let the position follow passwordbox Overlapping textbox Show it, And let passwordbox The data shows textbook Control. The definition here MouseLeftButtonDown and MouseLeftButtonUp event Here I use the next eye button to help passwordbox Control displays its original password. Can only be seen through certain auxiliary events. How can I make sure that the fields aren't empty if passwordbox.PasswordBox Control itself has no way to display the text entered by itself. I'm treating the password boxes like they're textboxes, with passwordbox.password, and so am not getting the desired result (is my guess). Checking whether the password fields have received user input. It's the first one that I'm struggling with. I can confirm the passwords perfectly well. If (canProceedUserPass = true & canProceedPass = true) Private void Button_Click(object sender, RoutedEventArgs e) MessageBox.Show("The two passwords must match!") If (NewPassword.Password = ConfirmNewPassword.Password) Checks the two passwords against one another. MessageBox.Show("You haven't filled out all the required fields.") ![]() If (NewUsername.Text != null & NewPassword.Password != null) Check to see if they've entered anything into the username and password boxes. ![]() Here's how I went about trying to do this: public bool canProceedPass = false The password can be confirmed by the user writing it out again, and unless they matched there would be no progression. The password fields have characters in them when the create account button is pressed. I wanted to make sure of a few things in relation to the passwords (focusing on pwords here because that's where i think the problem is). I'm creating a simple createaccount window which checks the user input before adding it to my SQL database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |