# Xui.Core.UI.Input

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`enum EventPhase`](#api-81130c41ad6e4671)
- [`class EventRouter`](#api-bbb1bb65c4162ada)
- [`interface IDrag`](#api-dc62d96ce29b06c0)
- [`interface IDragHorizontalTentative`](#api-e506a847fec7215f)
- [`interface IDragVerticalTentative`](#api-42b0dc3011a41471)
- [`interface IPointerGesture`](#api-824744db35a6bfed)
- [`interface ITap`](#api-d2b180a8d3fbef4b)
- [`enum PointerButton`](#api-0632cc7d4cd17621)
- [`enum PointerButtons`](#api-c0cd769d5d03a95b)
- [`ref struct PointerEventRef`](#api-e190806ba3e13fb6)
- [`enum PointerEventType`](#api-4f6d9431eabce462)
- [`readonly record struct PointerGestureCandidate`](#api-b55ac044962e10f5)
- [`class PointerGestures`](#api-568fac9d6264f67f)
- [`readonly struct PointerState`](#api-b5f297e05d2beaa6)
- [`enum PointerType`](#api-d9323a399cd93567)
- [`enum TextEditingChange`](#api-7d74cec3408d5dcf)
- [`class TextEditingState`](#api-df52c05343f33e20)
- [`enum TextInputAction`](#api-7a52bb2dadd73028)
- [`enum TextInputContentType`](#api-fd78154d11a4b600)
- [`enum TextInputKeyboard`](#api-ef40e16dbd5c7530)
- [`class TextInputNavigation`](#api-15203cbdf0d47839)
- [`readonly record struct TextInputOptions`](#api-321916a4aaa5310f)
- [`readonly record struct TextRange`](#api-ddf14b6bf3beab3d)

<a id="api-81130c41ad6e4671"></a>

## `enum EventPhase`

Defines the phase of event delivery through the view hierarchy.

```csharp
public enum EventPhase
{
    Tunnel,
    Bubble
}
```

<a id="api-ae0a022fd9f5d51e"></a>

### [`EventPhase.Bubble`](#api-ae0a022fd9f5d51e)


```csharp
Bubble
```

Event is bubbling from the target view up toward the root.

<a id="api-7491398841dc0017"></a>

### [`EventPhase.Tunnel`](#api-7491398841dc0017)


```csharp
Tunnel
```

Event is tunneling from the root down toward the target view.


<a id="api-bbb1bb65c4162ada"></a>

## `class EventRouter`

Routes pointer, mouse, scroll, and touch events through the view tree, performing hit testing, pointer capture, and enter/leave tracking.

```csharp
public class EventRouter
{
    public EventRouter(View rootView);
    public void Dispatch(ref TouchEventRef touchEvent);
    public void Dispatch(ref MouseDownEventRef e);
    public void Dispatch(ref MouseUpEventRef e);
    public void Dispatch(ref MouseMoveEventRef e);
    public void CapturePointer(View view, int pointerId, IPointerGesture? gesture = null);
    public void ReleasePointer(View view, int pointerId);
    public IPointerGesture? GetCapturedGesture(int pointerId);
    public View? GetCapturedView(int pointerId);
    public void Dispatch(ref ScrollWheelEventRef e, Point position);
    public void Dispatch(ref ZoomEventRef e, Point position);
}
```

<a id="api-829bcbaa888c636b"></a>

### [`EventRouter.EventRouter(View rootView)`](#api-829bcbaa888c636b)


```csharp
public EventRouter(View rootView);
```

Initializes a new [`Xui.Core.UI.Input.EventRouter`](../xui-core-ui-input/index.md#api-bbb1bb65c4162ada) rooted at the given view.

- **`rootView`** — The root of the view tree to route events through.

<a id="api-03fc56f5b8cf67e9"></a>

### [`void EventRouter.CapturePointer(View view, int pointerId, IPointerGesture? gesture = null)`](#api-03fc56f5b8cf67e9)


```csharp
public void CapturePointer(View view, int pointerId, IPointerGesture? gesture = null);
```

Captures all subsequent pointer events for the given pointer ID to `view`.

- **`view`** — The view that will exclusively receive events for this pointer.

- **`pointerId`** — The pointer identifier to capture.

- **`gesture`** — Optional marker describing what kind of gesture the view is tracking ([`Xui.Core.UI.Input.ITap`](../xui-core-ui-input/index.md#api-d2b180a8d3fbef4b), [`Xui.Core.UI.Input.IDrag`](../xui-core-ui-input/index.md#api-dc62d96ce29b06c0), …). Ancestor views can read this via [`Xui.Core.UI.Input.EventRouter.GetCapturedGesture(System.Int32)`](../xui-core-ui-input/index.md#api-255fba2a322197a3) to decide whether to steal capture.

<a id="api-ddcdec1e29340da9"></a>

### [`void EventRouter.Dispatch(ref MouseDownEventRef e)`](#api-ddcdec1e29340da9)


```csharp
public void Dispatch(ref MouseDownEventRef e);
```

Dispatches a mouse button down event as a pointer down event.

<a id="api-e14848a8aa16e49d"></a>

### [`void EventRouter.Dispatch(ref MouseMoveEventRef e)`](#api-e14848a8aa16e49d)


```csharp
public void Dispatch(ref MouseMoveEventRef e);
```

Dispatches a mouse move event as a pointer move event.

<a id="api-3661abcba0944010"></a>

### [`void EventRouter.Dispatch(ref MouseUpEventRef e)`](#api-3661abcba0944010)


```csharp
public void Dispatch(ref MouseUpEventRef e);
```

Dispatches a mouse button up event as a pointer up event.

<a id="api-fdfecf08b0e24b09"></a>

### [`void EventRouter.Dispatch(ref ScrollWheelEventRef e, Point position)`](#api-fdfecf08b0e24b09)


```csharp
public void Dispatch(ref ScrollWheelEventRef e, Point position);
```

Dispatches a scroll wheel event to the deepest view under `position` that handles it, bubbling up until [`Xui.Core.Abstract.Events.ScrollWheelEventRef.Handled`](../xui-core-abstract-events/index.md#api-e925616e42bc9886) is set.

<a id="api-659f98bb06565b31"></a>

### [`void EventRouter.Dispatch(ref TouchEventRef touchEvent)`](#api-659f98bb06565b31)


```csharp
public void Dispatch(ref TouchEventRef touchEvent);
```

Dispatches a touch event, translating each touch point into a pointer event.

<a id="api-0f1ef333ea3d8531"></a>

### [`void EventRouter.Dispatch(ref ZoomEventRef e, Point position)`](#api-0f1ef333ea3d8531)


```csharp
public void Dispatch(ref ZoomEventRef e, Point position);
```

Routes magnification to the innermost view under the anchor, then its ancestors.

<a id="api-255fba2a322197a3"></a>

### [`IPointerGesture? EventRouter.GetCapturedGesture(int pointerId)`](#api-255fba2a322197a3)


```csharp
public IPointerGesture? GetCapturedGesture(int pointerId);
```

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.

<a id="api-97fca75bb5c7ec7c"></a>

### [`View? EventRouter.GetCapturedView(int pointerId)`](#api-97fca75bb5c7ec7c)


```csharp
public View? GetCapturedView(int pointerId);
```

Returns the view currently holding pointer capture for `pointerId`, or `null` if the pointer is not captured.

<a id="api-e5026011bb5b7090"></a>

### [`void EventRouter.ReleasePointer(View view, int pointerId)`](#api-e5026011bb5b7090)


```csharp
public void ReleasePointer(View view, int pointerId);
```

Releases pointer capture previously set by [`Xui.Core.UI.Input.EventRouter.CapturePointer(Xui.Core.UI.View,System.Int32,Xui.Core.UI.Input.IPointerGesture)`](../xui-core-ui-input/index.md#api-03fc56f5b8cf67e9).

- **`view`** — The view that currently holds the capture.

- **`pointerId`** — The pointer identifier to release.


<a id="api-dc62d96ce29b06c0"></a>

## `interface IDrag`

A capturing view declares [`Xui.Core.UI.Input.IDrag`](../xui-core-ui-input/index.md#api-dc62d96ce29b06c0) when it is consuming pointer motion as ongoing input (e.g. a color wheel, a slider thumb, a drawing canvas). Ancestor scroll views and similar containers must not steal capture while an [`Xui.Core.UI.Input.IDrag`](../xui-core-ui-input/index.md#api-dc62d96ce29b06c0) gesture is active.

```csharp
public interface IDrag : IPointerGesture
{
}
```


<a id="api-e506a847fec7215f"></a>

## `interface IDragHorizontalTentative`

A horizontal-axis drag that is willing to yield capture to a vertical-axis ancestor whose drag intent appears stronger. Used by horizontal scroll views nested inside vertical ones: the inner scrolls horizontally from the first pointer move, but if the user&#39;s motion is dominantly vertical when crossing the recognition threshold, the outer scroll view steals capture. 

The capturing view is expected to &quot;promote&quot; itself by re-capturing with a plain [`Xui.Core.UI.Input.IDrag`](../xui-core-ui-input/index.md#api-dc62d96ce29b06c0) (e.g. [`Xui.Core.UI.Input.PointerGestures.Drag`](../xui-core-ui-input/index.md#api-d27829d7c303b523)) once horizontal motion has clearly committed to its axis (typical threshold: 20pt of horizontal travel). After promotion, vertical ancestors can no longer steal capture for this pointer.

```csharp
public interface IDragHorizontalTentative : IDrag
{
}
```


<a id="api-42b0dc3011a41471"></a>

## `interface IDragVerticalTentative`

A vertical drag willing to yield to a horizontal ancestor until its direction commits. Promote to [`Xui.Core.UI.Input.PointerGestures.Drag`](../xui-core-ui-input/index.md#api-d27829d7c303b523) once vertical intent is clear.

```csharp
public interface IDragVerticalTentative : IDrag
{
}
```


<a id="api-824744db35a6bfed"></a>

## `interface IPointerGesture`

Marker interface attached to a captured pointer to describe what kind of gesture the capturing view is performing. Ancestor views can inspect this (via [`Xui.Core.UI.Input.EventRouter.GetCapturedGesture(System.Int32)`](../xui-core-ui-input/index.md#api-255fba2a322197a3)) to negotiate handover — for example a `ScrollView` will steal an [`Xui.Core.UI.Input.ITap`](../xui-core-ui-input/index.md#api-d2b180a8d3fbef4b) after a drag threshold but stand down for an [`Xui.Core.UI.Input.IDrag`](../xui-core-ui-input/index.md#api-dc62d96ce29b06c0).

```csharp
public interface IPointerGesture
{
}
```


<a id="api-d2b180a8d3fbef4b"></a>

## `interface ITap`

A capturing view declares [`Xui.Core.UI.Input.ITap`](../xui-core-ui-input/index.md#api-d2b180a8d3fbef4b) when it is tracking a press that may or may not become a tap (e.g. `Button`, `Checkbox`). An ancestor that wants the pointer for a drag may steal capture after its own threshold is exceeded.

```csharp
public interface ITap : IPointerGesture
{
}
```


<a id="api-0632cc7d4cd17621"></a>

## `enum PointerButton`

Defines the mouse or pointer button associated with a pointer event, based on the W3C Pointer Events specification.

```csharp
public enum PointerButton : short
{
    None = -1,
    Left = 0,
    Middle = 1,
    Right = 2,
    X1 = 3,
    X2 = 4,
    Eraser = 5,
}
```

<a id="api-de2303f2dc95c866"></a>

### [`PointerButton.Eraser`](#api-de2303f2dc95c866)


```csharp
Eraser = 5
```

Pen eraser button (5).

<a id="api-44cc83c7d8f3913a"></a>

### [`PointerButton.Left`](#api-44cc83c7d8f3913a)


```csharp
Left = 0
```

Left mouse button, touch contact, or pen contact (0).

<a id="api-c4cbac5aa87021ed"></a>

### [`PointerButton.Middle`](#api-c4cbac5aa87021ed)


```csharp
Middle = 1
```

Middle mouse button (usually the scroll wheel button) (1).

<a id="api-dce0f6f43a20afd3"></a>

### [`PointerButton.None`](#api-dce0f6f43a20afd3)


```csharp
None = -1
```

No button or touch/pen contact change occurred (-1).

<a id="api-097864f9e0262836"></a>

### [`PointerButton.Right`](#api-097864f9e0262836)


```csharp
Right = 2
```

Right mouse button or pen barrel button (2).

<a id="api-2c511780e2bb4e88"></a>

### [`PointerButton.X1`](#api-2c511780e2bb4e88)


```csharp
X1 = 3
```

X1 (back) mouse button (3).

<a id="api-9756796bba0a5900"></a>

### [`PointerButton.X2`](#api-9756796bba0a5900)


```csharp
X2 = 4
```

X2 (forward) mouse button (4).


<a id="api-c0cd769d5d03a95b"></a>

## `enum PointerButtons`

Defines the set of mouse or pointer buttons currently pressed, based on the W3C Pointer Events specification.

```csharp
[Flags]
public enum PointerButtons : short
{
    None = 0,
    Left = 1 << 0,
    Right = 1 << 1,
    Middle = 1 << 2,
    X1 = 1 << 3,
    X2 = 1 << 4,
    Eraser = 1 << 5,
}
```

<a id="api-e048f9631338ee8e"></a>

### [`PointerButtons.Eraser`](#api-e048f9631338ee8e)


```csharp
Eraser = 1 << 5
```

Pen eraser button.

<a id="api-607c8b8e5818eda9"></a>

### [`PointerButtons.Left`](#api-607c8b8e5818eda9)


```csharp
Left = 1 << 0
```

Left mouse button, touch contact, or pen contact.

<a id="api-cd375b1bae8cf3f0"></a>

### [`PointerButtons.Middle`](#api-cd375b1bae8cf3f0)


```csharp
Middle = 1 << 2
```

Middle mouse button.

<a id="api-47acfc4d76ac0eb0"></a>

### [`PointerButtons.None`](#api-47acfc4d76ac0eb0)


```csharp
None = 0
```

No buttons are currently pressed.

<a id="api-be308aa25a359495"></a>

### [`PointerButtons.Right`](#api-be308aa25a359495)


```csharp
Right = 1 << 1
```

Right mouse button or pen barrel button.

<a id="api-86d5cef9df3cdb5a"></a>

### [`PointerButtons.X1`](#api-86d5cef9df3cdb5a)


```csharp
X1 = 1 << 3
```

X1 (back) mouse button.

<a id="api-3fa2028b3b1f6c83"></a>

### [`PointerButtons.X2`](#api-3fa2028b3b1f6c83)


```csharp
X2 = 1 << 4
```

X2 (forward) mouse button.


<a id="api-e190806ba3e13fb6"></a>

## `ref struct PointerEventRef`

Represents a reference to a pointer event routed to a view, containing identification and pointer state information.

```csharp
public ref struct PointerEventRef
{
    public readonly ReadOnlySpan<PointerGestureCandidate> PotentialGestures { get; }

    public readonly void PushPotentialGesture(View handler, IPointerGesture gesture);
    public readonly PointerEventType Type;
    public readonly int PointerId;
    public readonly long PersistentDeviceId;
    public readonly bool IsPrimary;
    public readonly PointerState State;
    public readonly ReadOnlySpan<PointerState> CoalescedStates;
    public readonly ReadOnlySpan<PointerState> PredictedStates;
    public readonly ITextMeasureContext? TextMeasure;
    public PointerEventRef(PointerEventType type, int pointerId, long persistentDeviceId, bool isPrimary, PointerState state, ReadOnlySpan<PointerState> coalescedStates, ReadOnlySpan<PointerState> predictedStates, ITextMeasureContext? textMeasure = null);
}
```

<a id="api-b31c09f31ac6bd67"></a>

### [`PointerEventRef.PointerEventRef(PointerEventType type, int pointerId, long persistentDeviceId, bool isPrimary, PointerState state, ReadOnlySpan<PointerState> coalescedStates, ReadOnlySpan<PointerState> predictedStates, ITextMeasureContext? textMeasure = null)`](#api-b31c09f31ac6bd67)


```csharp
public PointerEventRef(PointerEventType type, int pointerId, long persistentDeviceId, bool isPrimary, PointerState state, ReadOnlySpan<PointerState> coalescedStates, ReadOnlySpan<PointerState> predictedStates, ITextMeasureContext? textMeasure = null);
```

Initializes a new instance of the [`Xui.Core.UI.Input.PointerEventRef`](../xui-core-ui-input/index.md#api-e190806ba3e13fb6) struct.

<a id="api-6a121c90095216e6"></a>

### [`ReadOnlySpan<PointerState> PointerEventRef.CoalescedStates`](#api-6a121c90095216e6)


```csharp
public readonly ReadOnlySpan<PointerState> CoalescedStates;
```

Gets high-frequency coalesced samples recorded between the last and current events.

<a id="api-1b8be577a189a83c"></a>

### [`bool PointerEventRef.IsPrimary`](#api-1b8be577a189a83c)


```csharp
public readonly bool IsPrimary;
```

Gets a value indicating whether this pointer is the primary pointer in a multi-pointer interaction (e.g., first touch).

<a id="api-92240085c6ad9323"></a>

### [`long PointerEventRef.PersistentDeviceId`](#api-92240085c6ad9323)


```csharp
public readonly long PersistentDeviceId;
```

Gets the persistent device ID, if known. Identifies the underlying hardware across multiple pointer sessions.

<a id="api-5c7dbc352f691eed"></a>

### [`int PointerEventRef.PointerId`](#api-5c7dbc352f691eed)


```csharp
public readonly int PointerId;
```

Gets the unique ID of the pointer. Used to distinguish different active pointers (e.g., different fingers or pen tips).

<a id="api-458f91b2e659c0e1"></a>

### [`readonly ReadOnlySpan<PointerGestureCandidate> PointerEventRef.PotentialGestures`](#api-458f91b2e659c0e1)


```csharp
public readonly ReadOnlySpan<PointerGestureCandidate> PotentialGestures { get; }
```

Up to eight handlers pushed earlier during this event&#39;s down tunnel, oldest first. Storage is shared by the routed event copies and exists only for this dispatch; do not retain this span across events.

<a id="api-5fa40d83a1dfdd3f"></a>

### [`ReadOnlySpan<PointerState> PointerEventRef.PredictedStates`](#api-5fa40d83a1dfdd3f)


```csharp
public readonly ReadOnlySpan<PointerState> PredictedStates;
```

Gets future-predicted samples estimated from the current pointer movement.

<a id="api-3baf2363d97bcf90"></a>

### [`readonly void PointerEventRef.PushPotentialGesture(View handler, IPointerGesture gesture)`](#api-3baf2363d97bcf90)


```csharp
public readonly void PushPotentialGesture(View handler, IPointerGesture gesture);
```

Advertises a possible gesture without capturing the pointer. Call during Down/Tunnel so descendants can adapt feedback while recognition is pending. When full, drops the oldest handler and retains the newest eight. This does not change capture or the handler&#39;s recognition rules.

<a id="api-7e6fc8310499c030"></a>

### [`PointerState PointerEventRef.State`](#api-7e6fc8310499c030)


```csharp
public readonly PointerState State;
```

Gets the current physical state of the pointer (position, pressure, tilt, etc.).

<a id="api-7537ccabf01ae583"></a>

### [`ITextMeasureContext? PointerEventRef.TextMeasure`](#api-7537ccabf01ae583)


```csharp
public readonly ITextMeasureContext? TextMeasure;
```

Optional text measure context for hit-testing text positions. May be null on platforms that do not provide one.

<a id="api-cdb26dc2e974e42f"></a>

### [`PointerEventType PointerEventRef.Type`](#api-cdb26dc2e974e42f)


```csharp
public readonly PointerEventType Type;
```

Gets the type of pointer event (e.g., Down, Move, Up, Enter, Leave).


<a id="api-4f6d9431eabce462"></a>

## `enum PointerEventType`

Defines the type of action associated with a pointer event, based on the W3C Pointer Events specification.

```csharp
public enum PointerEventType
{
    Over,
    Enter,
    Down,
    Move,
    Up,
    Cancel,
    Out,
    Leave,
    GotCapture,
    LostCapture,
}
```

<a id="api-3817321055aede63"></a>

### [`PointerEventType.Cancel`](#api-3817321055aede63)


```csharp
Cancel
```

The pointer input was canceled by the system. Corresponds to the &quot;pointercancel&quot; event.

<a id="api-7f6af84c7aab69ea"></a>

### [`PointerEventType.Down`](#api-7f6af84c7aab69ea)


```csharp
Down
```

A pointer button has been pressed. Corresponds to the &quot;pointerdown&quot; event.

<a id="api-12fa46262dc45deb"></a>

### [`PointerEventType.Enter`](#api-12fa46262dc45deb)


```csharp
Enter
```

The pointer has entered the element or one of its descendants. Corresponds to the &quot;pointerenter&quot; event.

<a id="api-7709073bcc03ed90"></a>

### [`PointerEventType.GotCapture`](#api-7709073bcc03ed90)


```csharp
GotCapture
```

The pointer has been captured by the element. Corresponds to the &quot;gotpointercapture&quot; event.

<a id="api-e3d767cdc3ef7826"></a>

### [`PointerEventType.Leave`](#api-e3d767cdc3ef7826)


```csharp
Leave
```

The pointer has left the element and all its descendants. Corresponds to the &quot;pointerleave&quot; event.

<a id="api-b8398894b41c44b5"></a>

### [`PointerEventType.LostCapture`](#api-b8398894b41c44b5)


```csharp
LostCapture
```

The pointer capture has been released from the element. Corresponds to the &quot;lostpointercapture&quot; event.

<a id="api-b8d5a01991aa2618"></a>

### [`PointerEventType.Move`](#api-b8d5a01991aa2618)


```csharp
Move
```

The pointer has moved while being active. Corresponds to the &quot;pointermove&quot; event.

<a id="api-e4d3bd69529e0450"></a>

### [`PointerEventType.Out`](#api-e4d3bd69529e0450)


```csharp
Out
```

The pointer has moved off of the element&#39;s hit region. Corresponds to the &quot;pointerout&quot; event.

<a id="api-ef6116cd444ac9b5"></a>

### [`PointerEventType.Over`](#api-ef6116cd444ac9b5)


```csharp
Over
```

The pointer has moved onto the element&#39;s hit region. Corresponds to the &quot;pointerover&quot; event.

<a id="api-e64a117429d2e796"></a>

### [`PointerEventType.Up`](#api-e64a117429d2e796)


```csharp
Up
```

A pointer button has been released. Corresponds to the &quot;pointerup&quot; event.


<a id="api-b55ac044962e10f5"></a>

## `readonly record struct PointerGestureCandidate`

A handler advertising a possible gesture during pointer-down tunneling.

- **`Handler`** — The view which may later claim capture.

- **`Gesture`** — The gesture it may recognize.

```csharp
public readonly record struct PointerGestureCandidate(View Handler, IPointerGesture Gesture);
```

<a id="api-d51adca4a44022c1"></a>

### [`PointerGestureCandidate.PointerGestureCandidate(View Handler, IPointerGesture Gesture)`](#api-d51adca4a44022c1)


```csharp
public PointerGestureCandidate(View Handler, IPointerGesture Gesture);
```

A handler advertising a possible gesture during pointer-down tunneling.

- **`Handler`** — The view which may later claim capture.

- **`Gesture`** — The gesture it may recognize.

<a id="api-7aa07e75d6b4e052"></a>

### [`IPointerGesture PointerGestureCandidate.Gesture`](#api-7aa07e75d6b4e052)


```csharp
public IPointerGesture Gesture { get; init; }
```

The gesture it may recognize.

<a id="api-edf233ca4387d508"></a>

### [`View PointerGestureCandidate.Handler`](#api-edf233ca4387d508)


```csharp
public View Handler { get; init; }
```

The view which may later claim capture.


<a id="api-568fac9d6264f67f"></a>

## `class PointerGestures`

Singleton gesture markers used by simple widgets when capturing a pointer. Reusing these avoids per-event heap allocation. Widgets that need to carry extra state can implement [`Xui.Core.UI.Input.IPointerGesture`](../xui-core-ui-input/index.md#api-824744db35a6bfed) on their own type and pass an instance to `CapturePointer` instead.

```csharp
public static class PointerGestures
{
    public static ITap Tap { get; }
    public static IDrag Drag { get; }
    public static IDragHorizontalTentative DragHorizontalTentative { get; }
    public static IDragVerticalTentative DragVerticalTentative { get; }
}
```

<a id="api-d27829d7c303b523"></a>

### [`IDrag PointerGestures.Drag`](#api-d27829d7c303b523)


```csharp
public static IDrag Drag { get; }
```

Generic drag (e.g. color wheel, slider thumb) — ancestors must not steal.

<a id="api-d48c964d07c6cd2d"></a>

### [`IDragHorizontalTentative PointerGestures.DragHorizontalTentative`](#api-d48c964d07c6cd2d)


```csharp
public static IDragHorizontalTentative DragHorizontalTentative { get; }
```

A horizontal-axis drag that is tentatively willing to yield to a vertical-axis ancestor (see [`Xui.Core.UI.Input.IDragHorizontalTentative`](../xui-core-ui-input/index.md#api-e506a847fec7215f)). Replace with [`Xui.Core.UI.Input.PointerGestures.Drag`](../xui-core-ui-input/index.md#api-d27829d7c303b523) once horizontal motion has firmly committed.

<a id="api-51f8e490a3925bb5"></a>

### [`IDragVerticalTentative PointerGestures.DragVerticalTentative`](#api-51f8e490a3925bb5)


```csharp
public static IDragVerticalTentative DragVerticalTentative { get; }
```

A vertical drag that can yield to a horizontal ancestor before committing.

<a id="api-95067953a1ea6668"></a>

### [`ITap PointerGestures.Tap`](#api-95067953a1ea6668)


```csharp
public static ITap Tap { get; }
```

Generic tap (e.g. `Button`, `Checkbox`) — may be stolen by an ancestor drag.


<a id="api-b5f297e05d2beaa6"></a>

## `readonly struct PointerState`

Describes the physical state of a pointer at a specific moment in time, including position, pressure, tilt, and button information.

```csharp
public readonly struct PointerState
{
    public readonly Point Position;
    public readonly Size ContactSize;
    public readonly nfloat Pressure;
    public readonly bool HasPressure;
    public readonly nfloat TangentialPressure;
    public readonly Vector Tilt;
    public readonly nfloat Twist;
    public readonly nfloat AltitudeAngle;
    public readonly nfloat AzimuthAngle;
    public readonly PointerType PointerType;
    public readonly PointerButton Button;
    public readonly PointerButtons Buttons;
    public PointerState(Point position, Size contactSize, nfloat pressure, nfloat tangentialPressure, Vector tilt, nfloat twist, nfloat altitudeAngle, nfloat azimuthAngle, PointerType pointerType, PointerButton button, PointerButtons buttons, bool hasPressure = false);
    public PointerState WithPosition(Point position);
}
```

<a id="api-94927aab36c12776"></a>

### [`PointerState.PointerState(Point position, Size contactSize, NFloat pressure, NFloat tangentialPressure, Vector tilt, NFloat twist, NFloat altitudeAngle, NFloat azimuthAngle, PointerType pointerType, PointerButton button, PointerButtons buttons, bool hasPressure = false)`](#api-94927aab36c12776)


```csharp
public PointerState(Point position, Size contactSize, nfloat pressure, nfloat tangentialPressure, Vector tilt, nfloat twist, nfloat altitudeAngle, nfloat azimuthAngle, PointerType pointerType, PointerButton button, PointerButtons buttons, bool hasPressure = false);
```

Initializes a new instance of the [`Xui.Core.UI.Input.PointerState`](../xui-core-ui-input/index.md#api-b5f297e05d2beaa6) struct.

- **`position`** — The global position of the pointer.

- **`contactSize`** — The size of the contact area.

- **`pressure`** — The normalized pressure applied.

- **`tangentialPressure`** — The normalized tangential (barrel) pressure applied.

- **`tilt`** — The tilt vector of the pointer.

- **`twist`** — The clockwise twist rotation of the pointer.

- **`altitudeAngle`** — The altitude angle relative to the surface.

- **`azimuthAngle`** — The azimuth angle (compass direction).

- **`pointerType`** — The type of input device.

- **`button`** — The button that triggered the event.

- **`buttons`** — The set of currently pressed buttons.

- **`hasPressure`** — Whether the source supplies real pressure measurements.

<a id="api-d160f95274512f1e"></a>

### [`NFloat PointerState.AltitudeAngle`](#api-d160f95274512f1e)


```csharp
public readonly nfloat AltitudeAngle;
```

Gets the altitude angle of the pointer relative to the surface (0 = horizontal, π/2 = vertical), in radians.

<a id="api-577b37d8961b172c"></a>

### [`NFloat PointerState.AzimuthAngle`](#api-577b37d8961b172c)


```csharp
public readonly nfloat AzimuthAngle;
```

Gets the azimuth angle (compass direction) of the pointer around the vertical axis, in radians.

<a id="api-f2fb2a4f215d7549"></a>

### [`PointerButton PointerState.Button`](#api-f2fb2a4f215d7549)


```csharp
public readonly PointerButton Button;
```

Gets which button was responsible for triggering this pointer state change (left, right, middle, eraser, etc.).

<a id="api-6164e690b24c4768"></a>

### [`PointerButtons PointerState.Buttons`](#api-6164e690b24c4768)


```csharp
public readonly PointerButtons Buttons;
```

Gets the set of all currently pressed buttons on the device.

<a id="api-0d88336506cb5f0a"></a>

### [`Size PointerState.ContactSize`](#api-0d88336506cb5f0a)


```csharp
public readonly Size ContactSize;
```

Gets the size of the pointer&#39;s contact geometry, such as the area covered by a finger or stylus tip.

<a id="api-f82f31e8bf75acbe"></a>

### [`bool PointerState.HasPressure`](#api-f82f31e8bf75acbe)


```csharp
public readonly bool HasPressure;
```

Whether Pressure is a device measurement rather than a synthesized button value.

<a id="api-41c694a622b7e9ff"></a>

### [`PointerType PointerState.PointerType`](#api-41c694a622b7e9ff)


```csharp
public readonly PointerType PointerType;
```

Gets the type of device generating the pointer input (mouse, touch, pen, etc.).

<a id="api-cfcfdb024176e3e1"></a>

### [`Point PointerState.Position`](#api-cfcfdb024176e3e1)


```csharp
public readonly Point Position;
```

Gets the position of the pointer in global (window) coordinates.

<a id="api-acee929543263740"></a>

### [`NFloat PointerState.Pressure`](#api-acee929543263740)


```csharp
public readonly nfloat Pressure;
```

Gets the normalized pressure applied by the pointer (range: 0.0 to 1.0).

<a id="api-49c160f27199bca7"></a>

### [`NFloat PointerState.TangentialPressure`](#api-49c160f27199bca7)


```csharp
public readonly nfloat TangentialPressure;
```

Gets the normalized tangential (barrel) pressure applied by the pointer (range: -1.0 to 1.0).

<a id="api-256e7eea7a9ae891"></a>

### [`Vector PointerState.Tilt`](#api-256e7eea7a9ae891)


```csharp
public readonly Vector Tilt;
```

Gets the tilt of the pointer relative to the X and Y axes (in degrees).

<a id="api-534a4202f8ad59c5"></a>

### [`NFloat PointerState.Twist`](#api-534a4202f8ad59c5)


```csharp
public readonly nfloat Twist;
```

Gets the clockwise twist (rotation) of the pointer around its major axis, in degrees (0.0 to 359.9).

<a id="api-78442fc6e2d43bc4"></a>

### [`PointerState PointerState.WithPosition(Point position)`](#api-78442fc6e2d43bc4)


```csharp
public PointerState WithPosition(Point position);
```

Returns this state with a coordinate-space-specific position.


<a id="api-d9323a399cd93567"></a>

## `enum PointerType`

Defines the type of input device associated with a pointer event.

```csharp
public enum PointerType
{
    Mouse,
    Touch,
    Pen,
    Unknown,
}
```

<a id="api-964f33711d75a7cc"></a>

### [`PointerType.Mouse`](#api-964f33711d75a7cc)


```csharp
Mouse
```

A mouse device generated the pointer event.

<a id="api-cd720ec18987b483"></a>

### [`PointerType.Pen`](#api-cd720ec18987b483)


```csharp
Pen
```

A pen, stylus, or similar fine-point device generated the pointer event.

<a id="api-8ab7b23bcd65002f"></a>

### [`PointerType.Touch`](#api-8ab7b23bcd65002f)


```csharp
Touch
```

A touch contact (e.g., finger or capacitive touch) generated the pointer event.

<a id="api-0ed8234f7cecb25e"></a>

### [`PointerType.Unknown`](#api-0ed8234f7cecb25e)


```csharp
Unknown
```

The pointer device type could not be determined.


<a id="api-7d74cec3408d5dcf"></a>

## `enum TextEditingChange`

Changes reported before and after a text editing transaction.

```csharp
[Flags]
public enum TextEditingChange
{
    Text = 1,
    Selection = 2,
}
```

<a id="api-d4896e1723d1b524"></a>

### [`TextEditingChange.Selection`](#api-d4896e1723d1b524)


```csharp
Selection = 2
```

The insertion point or selected range changed.

<a id="api-0d82d94f0a06f5f6"></a>

### [`TextEditingChange.Text`](#api-0d82d94f0a06f5f6)


```csharp
Text = 1
```

The document or marked text changed.


<a id="api-df52c05343f33e20"></a>

## `class TextEditingState`

Single-line editing state shared by canvas text views and native input adapters. Offsets use UTF-16; selection and deletion respect Unicode grapheme boundaries.

```csharp
public sealed class TextEditingState
{
    public event Action<TextEditingChange>? Changing;
    public event Action<TextEditingChange>? Changed;
    public Func<char, bool>? InputFilter { get; set; }
    public string Text { get; set; }
    public TextRange Selection { get; set; }
    public TextRange? MarkedRange { get; }

    public int Boundary(int offset);
    public int Previous(int offset);
    public int Next(int offset);
    public TextRange Normalize(TextRange range);
    public bool Insert(string value);
    public bool Replace(TextRange range, string value);
    public void DeleteBackward();
    public void DeleteForward();
    public void SetMarkedText(string value, TextRange relativeSelection);
    public void UnmarkText();
}
```

<a id="api-2e5ca44d4185751c"></a>

### [`int TextEditingState.Boundary(int offset)`](#api-2e5ca44d4185751c)


```csharp
public int Boundary(int offset);
```

Finds the grapheme boundary at or before an offset.

<a id="api-cc68b95a85ad032f"></a>

### [`event Action<TextEditingChange>? TextEditingState.Changed`](#api-cc68b95a85ad032f)


```csharp
public event Action<TextEditingChange>? Changed;
```

Raised after an editing transaction.

<a id="api-9857babf9880a712"></a>

### [`event Action<TextEditingChange>? TextEditingState.Changing`](#api-9857babf9880a712)


```csharp
public event Action<TextEditingChange>? Changing;
```

Raised before an editing transaction, while old state is still readable.

<a id="api-12f5086cae552051"></a>

### [`void TextEditingState.DeleteBackward()`](#api-12f5086cae552051)


```csharp
public void DeleteBackward();
```

Deletes the selection or the grapheme before the caret.

<a id="api-824a1e709e847fd3"></a>

### [`void TextEditingState.DeleteForward()`](#api-824a1e709e847fd3)


```csharp
public void DeleteForward();
```

Deletes the selection or the grapheme after the caret.

<a id="api-8bad0f95c5d6c6a3"></a>

### [`Func<char, bool>? TextEditingState.InputFilter`](#api-8bad0f95c5d6c6a3)


```csharp
public Func<char, bool>? InputFilter { get; set; }
```

Optional validation for committed input; composition is validated when committed.

<a id="api-b91d14b9af53b74b"></a>

### [`bool TextEditingState.Insert(string value)`](#api-b91d14b9af53b74b)


```csharp
public bool Insert(string value);
```

Replaces the selection (or composition) atomically with committed input.

<a id="api-22fca70d715a95a6"></a>

### [`TextRange? TextEditingState.MarkedRange`](#api-22fca70d715a95a6)


```csharp
public TextRange? MarkedRange { get; }
```

The provisional IME composition range, or null.

<a id="api-b06d095f04eda064"></a>

### [`int TextEditingState.Next(int offset)`](#api-b06d095f04eda064)


```csharp
public int Next(int offset);
```

Finds the next grapheme boundary.

<a id="api-48d8cf029e9525f6"></a>

### [`TextRange TextEditingState.Normalize(TextRange range)`](#api-48d8cf029e9525f6)


```csharp
public TextRange Normalize(TextRange range);
```

Normalizes a range, expanding a nonempty range to whole graphemes.

<a id="api-cff4dacbcc4f573d"></a>

### [`int TextEditingState.Previous(int offset)`](#api-cff4dacbcc4f573d)


```csharp
public int Previous(int offset);
```

Finds the previous grapheme boundary.

<a id="api-91956f6d01462c6d"></a>

### [`bool TextEditingState.Replace(TextRange range, string value)`](#api-91956f6d01462c6d)


```csharp
public bool Replace(TextRange range, string value);
```

Replaces a range with validated single-line input.

<a id="api-746c732529330ade"></a>

### [`TextRange TextEditingState.Selection`](#api-746c732529330ade)


```csharp
public TextRange Selection { get; set; }
```

The normalized selection. Assignments are clamped to the document and grapheme boundaries.

<a id="api-9b359578cffb9691"></a>

### [`void TextEditingState.SetMarkedText(string value, TextRange relativeSelection)`](#api-9b359578cffb9691)


```csharp
public void SetMarkedText(string value, TextRange relativeSelection);
```

Updates provisional IME text; the selection is relative to the marked text.

<a id="api-5f21da086ef58851"></a>

### [`string TextEditingState.Text`](#api-5f21da086ef58851)


```csharp
public string Text { get; set; }
```

The document. Assignment ends composition and places the caret at the end.

<a id="api-e43ef646f7e58156"></a>

### [`void TextEditingState.UnmarkText()`](#api-e43ef646f7e58156)


```csharp
public void UnmarkText();
```

Commits composition, or restores the pre-composition document if validation fails.


<a id="api-7a52bb2dadd73028"></a>

## `enum TextInputAction`

An editing action from a software keyboard or its navigation controls.

```csharp
public enum TextInputAction
{
    Default,
    Previous,
    Next,
    Done,
}
```

<a id="api-8674b88e6ce6ec76"></a>

### [`TextInputAction.Default`](#api-8674b88e6ce6ec76)


```csharp
Default
```

Use the field&#39;s configured action; otherwise finish editing.

<a id="api-f8cad68b8891e2d4"></a>

### [`TextInputAction.Done`](#api-f8cad68b8891e2d4)


```csharp
Done
```

Finish editing and release keyboard focus.

<a id="api-a2ecef895e4cf8ff"></a>

### [`TextInputAction.Next`](#api-a2ecef895e4cf8ff)


```csharp
Next
```

Focus the next control, or finish editing at the end.

<a id="api-92f312cf8b6d85aa"></a>

### [`TextInputAction.Previous`](#api-92f312cf8b6d85aa)


```csharp
Previous
```

Focus the preceding text input, without wrapping.


<a id="api-fd78154d11a4b600"></a>

## `enum TextInputContentType`

Semantic hints for platform suggestions and autofill.

```csharp
public enum TextInputContentType
{
    None,
    Name,
    Password,
}
```

<a id="api-1a004896f337064d"></a>

### [`TextInputContentType.Name`](#api-1a004896f337064d)


```csharp
Name
```

A person&#39;s name.

<a id="api-9086ab522c3b5621"></a>

### [`TextInputContentType.None`](#api-9086ab522c3b5621)


```csharp
None
```

No specific semantic hint.

<a id="api-cc807a6b85d7fbd7"></a>

### [`TextInputContentType.Password`](#api-cc807a6b85d7fbd7)


```csharp
Password
```

An existing password. Masking is controlled separately by IsPassword.


<a id="api-ef40e16dbd5c7530"></a>

## `enum TextInputKeyboard`

Keyboard layout hint. Character validation remains the editor&#39;s responsibility.

```csharp
public enum TextInputKeyboard
{
    Text,
    Ascii,
    Number,
    Decimal,
}
```

<a id="api-b7ac016f6e614c40"></a>

### [`TextInputKeyboard.Ascii`](#api-b7ac016f6e614c40)


```csharp
Ascii
```

ASCII letters, numbers and punctuation, for values such as hex colors.

<a id="api-262d65a3676ce40b"></a>

### [`TextInputKeyboard.Decimal`](#api-262d65a3676ce40b)


```csharp
Decimal
```

Digits and a decimal separator.

<a id="api-a7f6dd87983a3b10"></a>

### [`TextInputKeyboard.Number`](#api-a7f6dd87983a3b10)


```csharp
Number
```

Digits.

<a id="api-1103cfaff46d5d23"></a>

### [`TextInputKeyboard.Text`](#api-1103cfaff46d5d23)


```csharp
Text
```

Ordinary text in the user&#39;s language.


<a id="api-15203cbdf0d47839"></a>

## `class TextInputNavigation`

Shared focus behavior for single-line editors and native keyboard actions.

```csharp
public static class TextInputNavigation
{
    public static bool CanPerform(View view, TextInputAction action);
    public static void Perform(View view, TextInputAction action);
}
```

<a id="api-c8ce6c890850a98f"></a>

### [`bool TextInputNavigation.CanPerform(View view, TextInputAction action)`](#api-c8ce6c890850a98f)


```csharp
public static bool CanPerform(View view, TextInputAction action);
```

Whether an action is available for the currently focused editor.

<a id="api-1b4d7924d44861ac"></a>

### [`void TextInputNavigation.Perform(View view, TextInputAction action)`](#api-1b4d7924d44861ac)


```csharp
public static void Perform(View view, TextInputAction action);
```

Moves through focus order without wrapping, or dismisses the keyboard.


<a id="api-321916a4aaa5310f"></a>

## `readonly record struct TextInputOptions`

Platform-independent keyboard hints, read when a field receives focus. These do not restrict pasted, dictated, or hardware-keyboard input; use InputFilter for validation.

```csharp
public readonly record struct TextInputOptions(TextInputKeyboard Keyboard = TextInputKeyboard.Text, TextInputContentType ContentType = TextInputContentType.None, TextInputAction ReturnAction = TextInputAction.Default);
```

<a id="api-e2127de347522401"></a>

### [`TextInputOptions.TextInputOptions(TextInputKeyboard Keyboard = TextInputKeyboard.Text, TextInputContentType ContentType = TextInputContentType.None, TextInputAction ReturnAction = TextInputAction.Default)`](#api-e2127de347522401)


```csharp
public TextInputOptions(TextInputKeyboard Keyboard = TextInputKeyboard.Text, TextInputContentType ContentType = TextInputContentType.None, TextInputAction ReturnAction = TextInputAction.Default);
```

Platform-independent keyboard hints, read when a field receives focus. These do not restrict pasted, dictated, or hardware-keyboard input; use InputFilter for validation.

<a id="api-525ddfca161829a6"></a>

### [`TextInputContentType TextInputOptions.ContentType`](#api-525ddfca161829a6)


```csharp
public TextInputContentType ContentType { get; init; }
```



<a id="api-9db4e6e97a5ed4ac"></a>

### [`TextInputKeyboard TextInputOptions.Keyboard`](#api-9db4e6e97a5ed4ac)


```csharp
public TextInputKeyboard Keyboard { get; init; }
```



<a id="api-763a6f4f79c87f1d"></a>

### [`TextInputAction TextInputOptions.ReturnAction`](#api-763a6f4f79c87f1d)


```csharp
public TextInputAction ReturnAction { get; init; }
```




<a id="api-ddf14b6bf3beab3d"></a>

## `readonly record struct TextRange`

A UTF-16 range in a text document, with an exclusive end.

```csharp
public readonly record struct TextRange(int Start, int End)
{
    public int Length { get; }
}
```

<a id="api-13e5b38db51e5899"></a>

### [`TextRange.TextRange(int Start, int End)`](#api-13e5b38db51e5899)


```csharp
public TextRange(int Start, int End);
```

A UTF-16 range in a text document, with an exclusive end.

<a id="api-eff1101079711715"></a>

### [`int TextRange.End`](#api-eff1101079711715)


```csharp
public int End { get; init; }
```



<a id="api-5632b1f1748c6b9a"></a>

### [`int TextRange.Length`](#api-5632b1f1748c6b9a)


```csharp
public int Length { get; }
```

The number of UTF-16 code units in the range.

<a id="api-4906276c7dbfa86d"></a>

### [`int TextRange.Start`](#api-4906276c7dbfa86d)


```csharp
public int Start { get; init; }
```



