AB.
AB.

Reputation: 282

WPF routed events , tunneling and bubbling

What is the thinking/philosophy behind having tunneling before Bubbling and not viceversa .

Upvotes: 1

Views: 3455

Answers (2)

rockeye
rockeye

Reputation: 2773

Tunneling is before bubbeling because event handlers are in the element tree root.

This is well explained here in "Routing strategies"

Upvotes: 1

Vlagged
Vlagged

Reputation: 513

This gives the container, for example, the power to see an event before its children. This is useful in many cases, as e.g. disabling children, hover animations, drag'n'drop, selecting a parent container before continuing checking/clicking the child widget etc.

In other words, IMO it's easier to create a new container for a custom UI behavior and preview the events (tunneling) that go to stock widgets, than to create custom widgets and using a stock container (bubbling).

Upvotes: 2

Related Questions