I use events all the time, I cheat and use autocomplete in Visual Studio. Object.closing += [tab] button. Put something in the autogenerated function. Some people like to emphasize the "routed" nature of it, and that leads me to believe I'm missing something. Is there more to it? What am I supposed to know about routed events?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Unless I'm missing something, it doesn't sound like you are describing a routed event. Routed events are part of the WPF technology and are described here.
A routed event works where you have a hierarchy of objects in a tree structure--just like you would with a WPF page. Each control is a node on the display tree, with the root node being the Window or Dialog box your XAML file describes. The challenge with this structure is that it is difficult to get and extend the reference of the button you want with the click handler for it. By default the WPF controls will still handle the mouse and keyboard events, but if there are no registered handlers on the object itself, it will pass the event up the hierarchy until something handles it.
The "RoutedEvent" has a reference to the source object and rules for navigating the display tree. That's the "Bubbling", "Direct", or "Tunneling" options described in the article I linked to. Each component knows want to do when it receives a routed event with that rule attached to it.
That is a bit different than declaring an event on a class you created, and then invoking that as needed. Essentially, with that approach, the only event model available is "Direct". The autocomplete that you do in Visual Studio simply generates the handler for you. The WPF structure handles the routing for you, so there's little you have to think about in most cases. It's only when you want to customize how the events behave within the screen that you need to really concern yourself with the intricacies of routed events.