InputAdapter Class
Watches a System.Windows.UIElement for various input-related events and publishes them in a platform agnostic way.
public class InputAdapter
- Inheritance:
- System.Object Object
Constructors
InputAdapter(UIElement)
Initializes a new instance of the InputAdapter class.
public InputAdapter(UIElement element)
Parameter | Type | Description |
---|---|---|
element | System.Windows.UIElement | The System.Windows.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
- System.Boolean:
true
if the adapter is currently attached to any events; otherwise,false
.
See Also
TargetElement
Gets the target System.Windows.UIElement that is being watched.
public UIElement TargetElement { get; }
Property Value
- System.Windows.UIElement:
The target System.Windows.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
- System.Boolean:
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 | System.Windows.UIElement | The target element. |
Returns
- System.Boolean:
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
- System.Boolean:
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
- System.EventHandler<InputDoubleTappedEventArgs>
KeyDown
Occurs when a keyboard key is pressed.
public event EventHandler<InputKeyEventArgs> KeyDown
Event Type
- System.EventHandler<InputKeyEventArgs>
KeyUp
Occurs when a keyboard key is released.
public event EventHandler<InputKeyEventArgs> KeyUp
Event Type
- System.EventHandler<InputKeyEventArgs>
PointerCaptureLost
Occurs when the pointer capture is lost.
public event EventHandler<InputPointerEventArgs> PointerCaptureLost
Event Type
- System.EventHandler<InputPointerEventArgs>
PointerEntered
Occurs when the pointer enters the element.
public event EventHandler<InputPointerEventArgs> PointerEntered
Event Type
- System.EventHandler<InputPointerEventArgs>
PointerExited
Occurs when the pointer exits the element.
public event EventHandler<InputPointerEventArgs> PointerExited
Event Type
- System.EventHandler<InputPointerEventArgs>
PointerMoved
Occurs when the pointer moves over the element.
public event EventHandler<InputPointerEventArgs> PointerMoved
Event Type
- System.EventHandler<InputPointerEventArgs>
PointerPressed
Occurs when a pointer button is pressed over the element.
public event EventHandler<InputPointerButtonEventArgs> PointerPressed
Event Type
- System.EventHandler<InputPointerButtonEventArgs>
PointerReleased
Occurs when a pointer button is released over the element.
public event EventHandler<InputPointerButtonEventArgs> PointerReleased
Event Type
- System.EventHandler<InputPointerButtonEventArgs>
PointerWheelChanged
Occurs when a pointer wheel is changed over the element.
public event EventHandler<InputPointerWheelEventArgs> PointerWheelChanged
Event Type
- System.EventHandler<InputPointerWheelEventArgs>
Tapped
Occurs when the element is tapped.
public event EventHandler<InputTappedEventArgs> Tapped
Event Type
- System.EventHandler<InputTappedEventArgs>
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()