Sunday, December 23, 2018

Advantage of Routed Event?

The single routed event is listening for three buttons. If you try to write the same code using ordinary events, you'll have to use three separated events, one event by button.

This means that, instead of defining multiple events on every control in a same child, you have to define a routed event at the parent level, which will be raised by every concerned child.

A click occurs in a button and rises up to its StackPanel and then to the containing window where one code handles all clicks.
Routed events give us the flexibility to write our event handler code in the most conveniant place. 

No comments:

Followers

Link