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 a new instance of the InputAdapter class.
public InputAdapter(IInputElement element)
Parameter | Type | Description |
---|---|---|
element | IInputElement | The IInputElement 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 IInputElement that is being watched.
public IInputElement TargetElement { get; }
Property Value
- IInputElement:
The target IInputElement 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, 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:
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
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