Private void button2_click (object sender, RoutedEventArgs e) {}
Look at the WPF content recently, and look back. NET everyone is using it every day, but it is not an object of great concern----sender
Q: What exactly is sender?
A: All the events in the server control will have (probably too absolute, should say mostly), sender refers to the control that triggers the event.
Private void button2_click (object sender, RoutedEventArgs e) { = (Button) sender;// Method one "kick [email protected]"; // button2. Content = "Kick ME";//Method two }
Here is the core of the sender, what is the control that triggers the event?
There are two buttons on the interface (this is a WPF program, when 2 buttons are bound to a Click event button2_click↑).
button2_click the method of this event to change the name of the button. Point "button One" will become " "and point" button Two "will also become " kick [email protected] "This is the description sender refers to the control that triggers the event!
If you follow Button2_Click The method of this event two to change the name of the button. Click "button One" will make the button two "kick [email protected]", point "button Two" will not have any reaction