Don't try to "find a way" by just "looking" at the topics you have mentioned — first actually read them without connection to your particular problem to understand how events work and then how do they work in WPF. Right now you are so confused that you cannot even formulate what do you want correctly.
The whole idea of "catch the event on the… control…" is wrong because there is no such thing. The even is not "caught" and not even handled on any particular control, but it is fired by some code of some particular class. It is handled by any event handler which you can add to an invocation list of any event instance; and this event handler is not related to any particular control and can be a method of any class or (better) an anonymous method added in the code of any class.
Next thing: you cannot fire an event like
Button.Click
. This event can be fired and actually already coded to fire in the class
Button
. You do not need to fire it and, in fact, you never can. An event can only be fired in the class where it is declared; this is one of the important fool-proof limitations of events compared to regular delegate instances.
All you can do with an already defined event is adding some event handler to its invocation list or removing a previously added handler:
class AnyClassAnyAtAll {
void AnyMethod() {
myButton.Click += (sender, eventArgs) => {
Button instance = (Button)sender;
DoSomethingOnButtonClick();
}
}
void DoSomethingOnButtonClick() {}
}
If this is still not clear, you should do the following: 1) set your WPF application aside for a while, as you are not ready yet; 2) read some C# manual (not WPF) from the beginning to the end; 3) make sure you can solve all or most of the simple exercises from the manual, prefer console applications; 4) come back to more complex topics like WPF.
Good luck,
—SA