InputAdapter Class
Watches a IInputElement for various input-related events and publishes them in a platform agnostic way.
public class InputAdapter
- Inheritance:
- object object
Constructors
InputAdapter(IInputElement)
Initializes an instance of the class.
public InputAdapter(IInputElement element)
| Parameter | Type | Description |
|---|---|---|
| element | IInputElement | The IInputElement to watch for input-related events. |
Properties
AttachedEventKinds
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
Indicates whether the adapter is currently attached to any events.
public bool IsAttached { get; }
Property Value
- bool:
trueif the adapter is currently attached to any events; otherwise,false.
See Also
TargetElement
The target IInputElement that is being watched.
TargetElementOrThrowIfNull
The target IInputElement that is being watched. If null, an
exception will be thrown.
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:
trueif the pointer was captured; otherwise,false.
Remarks
This method should only be called in a PointerPressed event handlers.
CapturePointer(InputPointerEventArgs, IInputElement)
Captures the pointer that sourced the specified event arguments on a designated target element.
public bool CapturePointer(InputPointerEventArgs e, IInputElement targetElement)
| Parameter | Type | Description |
|---|---|---|
| e | InputPointerEventArgs | The event arguments to examine. |
| targetElement | IInputElement | The target element. |
Returns
- bool:
trueif the pointer was captured; otherwise,false.
Remarks
This method should only be called in a PointerPressed event handlers.
IsAttachedTo(InputAdapterEventKinds)
Indicates whether the specified event kind is currently attached.
public bool IsAttachedTo(InputAdapterEventKinds kind)
| Parameter | Type | Description |
|---|---|---|
| kind | InputAdapterEventKinds | The kind of event. |
Returns
- bool:
trueif the specified event kind is currently attached; otherwise,false.
See Also
ReleasePointerCaptures()
Releases all pointer captures.
public void ReleasePointerCaptures()
Events
PointerCaptureLost
Occurs when the pointer capture is lost.
public event EventHandler<InputPointerEventArgs>? PointerCaptureLost
Event Type
PointerEntered
Occurs when the pointer enters the element.
public event EventHandler<InputPointerEventArgs>? PointerEntered
Event Type
PointerExited
Occurs when the pointer exits the element.
public event EventHandler<InputPointerEventArgs>? PointerExited
Event Type
PointerMoved
Occurs when the pointer moves over the element.
public event EventHandler<InputPointerEventArgs>? PointerMoved
Event Type
PointerPressed
Occurs when a pointer button is pressed over the element.
public event EventHandler<InputPointerButtonEventArgs>? PointerPressed
Event Type
PointerReleased
Occurs when a pointer button is released over the element.
public event EventHandler<InputPointerButtonEventArgs>? PointerReleased
Event Type
PointerWheelChanged
Occurs when a pointer wheel is changed over the element.
public event EventHandler<InputPointerWheelEventArgs>? PointerWheelChanged
Event Type
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()