In This Article

InputAdapter Class

Watches a UIElement for various input-related events and publishes them in a platform agnostic way.

public class InputAdapter
Inheritance:
object object

Constructors

InputAdapter(UIElement)

Initializes a new instance of the InputAdapter class.

public InputAdapter(UIElement element)
Parameter Type Description
element UIElement

The UIElement to watch for input-related events.

Properties

AttachedEventKinds

Gets or sets the kinds of events that should be attached to and notified by this class.

public InputAdapterEventKinds AttachedEventKinds { get; set; }

Property Value

InputAdapterEventKinds:

A flags-based InputAdapterEventKinds that indicates the events to attach.

IsAttached

Gets whether the adapter is currently attached to any events.

public bool IsAttached { get; }

Property Value

bool:

true if the adapter is currently attached to any events; otherwise, false.

See Also

TargetElement

Gets the target UIElement that is being watched.

public UIElement TargetElement { get; }

Property Value

UIElement:

The target UIElement that is being watched.

Methods

CapturePointer(InputPointerEventArgs)

Captures the pointer that sourced the specified event arguments.

public bool CapturePointer(InputPointerEventArgs e)
Parameter Type Description
e InputPointerEventArgs

The event arguments to examine.

Returns

bool:

true if the pointer was captured; otherwise, false.

Remarks

This method should only be called in a PointerPressed event handlers.

CapturePointer(InputPointerEventArgs, UIElement)

Captures the pointer that sourced the specified event arguments on a designated target element.

public bool CapturePointer(InputPointerEventArgs e, UIElement targetElement)
Parameter Type Description
e InputPointerEventArgs

The event arguments to examine.

targetElement UIElement

The target element.

Returns

bool:

true if the pointer was captured; otherwise, false.

Remarks

This method should only be called in a PointerPressed event handlers.

IsAttachedTo(InputAdapterEventKinds)

Returns whether the specified event kind is currently attached.

public bool IsAttachedTo(InputAdapterEventKinds kind)
Parameter Type Description
kind InputAdapterEventKinds

The kind of event.

Returns

bool:

true if the specified event kind is currently attached; otherwise, false.

See Also

ReleasePointerCaptures()

Releases all pointer captures.

public void ReleasePointerCaptures()

Events

DoubleTapped

Occurs when the element is double-tapped.

public event EventHandler<InputDoubleTappedEventArgs> DoubleTapped

Event Type

EventHandler<InputDoubleTappedEventArgs>

KeyDown

Occurs when a keyboard key is pressed.

public event EventHandler<InputKeyEventArgs> KeyDown

Event Type

EventHandler<InputKeyEventArgs>

KeyUp

Occurs when a keyboard key is released.

public event EventHandler<InputKeyEventArgs> KeyUp

Event Type

EventHandler<InputKeyEventArgs>

PointerCaptureLost

Occurs when the pointer capture is lost.

public event EventHandler<InputPointerEventArgs> PointerCaptureLost

Event Type

EventHandler<InputPointerEventArgs>

PointerEntered

Occurs when the pointer enters the element.

public event EventHandler<InputPointerEventArgs> PointerEntered

Event Type

EventHandler<InputPointerEventArgs>

PointerExited

Occurs when the pointer exits the element.

public event EventHandler<InputPointerEventArgs> PointerExited

Event Type

EventHandler<InputPointerEventArgs>

PointerMoved

Occurs when the pointer moves over the element.

public event EventHandler<InputPointerEventArgs> PointerMoved

Event Type

EventHandler<InputPointerEventArgs>

PointerPressed

Occurs when a pointer button is pressed over the element.

public event EventHandler<InputPointerButtonEventArgs> PointerPressed

Event Type

EventHandler<InputPointerButtonEventArgs>

PointerReleased

Occurs when a pointer button is released over the element.

public event EventHandler<InputPointerButtonEventArgs> PointerReleased

Event Type

EventHandler<InputPointerButtonEventArgs>

PointerWheelChanged

Occurs when a pointer wheel is changed over the element.

public event EventHandler<InputPointerWheelEventArgs> PointerWheelChanged

Event Type

EventHandler<InputPointerWheelEventArgs>

Tapped

Occurs when the element is tapped.

public event EventHandler<InputTappedEventArgs> Tapped

Event Type

EventHandler<InputTappedEventArgs>

Inherited Members