- Most controls in WPF inherit a series of events from the UIElement class such as PreviewMouseMove (tunneling) and MouseMove (bubbling) events.
- Because these events propagate, however, the events will also tunnel down to the control and then bubble back up the logical tree.
- Tunnelling event first comes to the outermost control, then comes to the inner controls layer by layer. Bubbling event first comes to the innermost control, then comes to outer controls layer by layer.
- For example, if we have a TextBox inside a StackPanel that is inside a Window and we move the mouse around within the TextBox, we’ll see the following events fired:
- PreviewMouseMove on Window
- PreviewMouseMove on StackPanel
- PreviewMouseMove on TextBox (sometimes just stop here)
- MouseMove on TextBox (sometimes won't be fired/triggered)
- MouseMove on StackPanel (sometimes won't be fired/triggered)
- Mousemove on Window (sometimes won't be fired/triggered)