Table of Contents

Class EventRouter

Namespace
Xui.Core.UI.Input
Assembly
Xui.Core.dll

Routes pointer, mouse, scroll, and touch events through the view tree, performing hit testing, pointer capture, and enter/leave tracking.

public class EventRouter
Inheritance
EventRouter
Inherited Members

Constructors

EventRouter(View)

Initializes a new EventRouter rooted at the given view.

public EventRouter(View rootView)

Parameters

rootView View

The root of the view tree to route events through.

Methods

CapturePointer(View, int, IPointerGesture?)

Captures all subsequent pointer events for the given pointer ID to view.

public void CapturePointer(View view, int pointerId, IPointerGesture? gesture = null)

Parameters

view View

The view that will exclusively receive events for this pointer.

pointerId int

The pointer identifier to capture.

gesture IPointerGesture

Optional marker describing what kind of gesture the view is tracking (ITap, IDrag, …). Ancestor views can read this via GetCapturedGesture(int) to decide whether to steal capture.

Dispatch(ref MouseDownEventRef)

Dispatches a mouse button down event as a pointer down event.

public void Dispatch(ref MouseDownEventRef e)

Parameters

e MouseDownEventRef

Dispatch(ref MouseMoveEventRef)

Dispatches a mouse move event as a pointer move event.

public void Dispatch(ref MouseMoveEventRef e)

Parameters

e MouseMoveEventRef

Dispatch(ref MouseUpEventRef)

Dispatches a mouse button up event as a pointer up event.

public void Dispatch(ref MouseUpEventRef e)

Parameters

e MouseUpEventRef

Dispatch(ref ScrollWheelEventRef, Point)

Dispatches a scroll wheel event to the deepest view under position that handles it, bubbling up until Handled is set.

public void Dispatch(ref ScrollWheelEventRef e, Point position)

Parameters

e ScrollWheelEventRef
position Point

Dispatch(ref TouchEventRef)

Dispatches a touch event, translating each touch point into a pointer event.

public void Dispatch(ref TouchEventRef touchEvent)

Parameters

touchEvent TouchEventRef

GetCapturedGesture(int)

Returns the gesture marker associated with the current capture for pointerId, or null if the pointer is not captured or was captured without a gesture marker.

public IPointerGesture? GetCapturedGesture(int pointerId)

Parameters

pointerId int

Returns

IPointerGesture

GetCapturedView(int)

Returns the view currently holding pointer capture for pointerId, or null if the pointer is not captured.

public View? GetCapturedView(int pointerId)

Parameters

pointerId int

Returns

View

ReleasePointer(View, int)

Releases pointer capture previously set by CapturePointer(View, int, IPointerGesture?).

public void ReleasePointer(View view, int pointerId)

Parameters

view View

The view that currently holds the capture.

pointerId int

The pointer identifier to release.