Follow an event through Xui
One press can pass through several views. Understand the route before adding handlers, or a button can fire twice and a scroll container can compete with its children.
The path starts in a platform runtime. Its Actual window forwards native input to the Abstract window, then RootView hands pointer input to EventRouter. The router hit-tests the tree, chooses a target, and delivers the event through that target's ancestors.
Tunnel down, bubble up
For an ordinary pointer event, tunnel delivery starts at the root and travels toward the target. Bubble delivery starts at the target and travels back toward the root. The target receives both phases. Choose one phase for each action.
The counter example increments only on Down/Bubble. The drag example captures one pointer and follows that same pointer until release or cancellation. These examples show two different meanings for a press; the router does not choose the meaning for you.
Hit testing walks children in reverse order, so the last hit-testable child is considered first. A parent's hit-test failure stops descent into that branch. Check clipping, transforms, and parent geometry when an otherwise visible child does not receive input.
Capture changes the target
CapturePointer(id, gesture) routes subsequent events for that ID to the capturing view, even outside its bounds. Ancestors remain on the route; capture is not a switch that disables the rest of the tree. Scroll containers inspect the gesture marker to decide whether they may take over.
Handle LostCapture and Cancel as cleanup paths. Do not commit a click from either. Release capture when the interaction ends and when the view deactivates. A pointer ID identifies one contact sequence, not a permanent person or device.
Use each event's actual contract
PointerEventRef has no Handled property. It carries phase-independent pointer data, capture-related gesture candidates, and optional text measurement. Wheel and zoom events do have Handled; their router delivers to the innermost matching view and stops bubbling when a handler sets it. Keyboard input goes to the focused view, with Tab navigation handled by RootView.
The router maps State.Position through GlobalToLocal before delivering a pointer event. Do not apply that conversion again. Standard view frames share the existing layout coordinate model; subtract Frame.X/Frame.Y when your drawing uses a translated zero origin.
Events are ref struct values. Read them during dispatch and copy only the small values you need. Do not retain an event, its spans, or its temporary measurement context for later asynchronous work.