Class InputElement
Implements input-related functionality for a control.
[PseudoClasses(new string[] { ":disabled", ":focus", ":focus-visible", ":focus-within", ":pointerover" })]
public class InputElement : Interactive, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement
- Inheritance
-
InputElement
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
InputElement()
public InputElement()
Fields
CursorProperty
Gets or sets associated mouse cursor.
public static readonly StyledProperty<Cursor?> CursorProperty
Field Value
DoubleTappedEvent
Defines the DoubleTapped event.
public static readonly RoutedEvent<TappedEventArgs> DoubleTappedEvent
Field Value
FocusableProperty
Defines the Focusable property.
public static readonly StyledProperty<bool> FocusableProperty
Field Value
GotFocusEvent
Defines the GotFocus event.
public static readonly RoutedEvent<GotFocusEventArgs> GotFocusEvent
Field Value
HoldingEvent
Defines the Holding event.
public static readonly RoutedEvent<HoldingRoutedEventArgs> HoldingEvent
Field Value
IsEffectivelyEnabledProperty
Defines the IsEffectivelyEnabled property.
public static readonly DirectProperty<InputElement, bool> IsEffectivelyEnabledProperty
Field Value
IsEnabledProperty
Defines the IsEnabled property.
public static readonly StyledProperty<bool> IsEnabledProperty
Field Value
IsFocusedProperty
Defines the IsFocused property.
public static readonly DirectProperty<InputElement, bool> IsFocusedProperty
Field Value
IsHitTestVisibleProperty
Defines the IsHitTestVisible property.
public static readonly StyledProperty<bool> IsHitTestVisibleProperty
Field Value
IsKeyboardFocusWithinProperty
Defines the IsKeyboardFocusWithin property.
public static readonly DirectProperty<InputElement, bool> IsKeyboardFocusWithinProperty
Field Value
IsPointerOverProperty
Defines the IsPointerOver property.
public static readonly DirectProperty<InputElement, bool> IsPointerOverProperty
Field Value
IsTabStopProperty
Defines the IsTabStop property.
public static readonly StyledProperty<bool> IsTabStopProperty
Field Value
KeyDownEvent
Defines the KeyDown event.
public static readonly RoutedEvent<KeyEventArgs> KeyDownEvent
Field Value
KeyUpEvent
Defines the KeyUp event.
public static readonly RoutedEvent<KeyEventArgs> KeyUpEvent
Field Value
LostFocusEvent
Defines the LostFocus event.
public static readonly RoutedEvent<RoutedEventArgs> LostFocusEvent
Field Value
PointerCaptureLostEvent
Defines the PointerCaptureLost routed event.
public static readonly RoutedEvent<PointerCaptureLostEventArgs> PointerCaptureLostEvent
Field Value
PointerEnteredEvent
Defines the PointerEntered event.
public static readonly RoutedEvent<PointerEventArgs> PointerEnteredEvent
Field Value
PointerExitedEvent
Defines the PointerExited event.
public static readonly RoutedEvent<PointerEventArgs> PointerExitedEvent
Field Value
PointerMovedEvent
Defines the PointerMoved event.
public static readonly RoutedEvent<PointerEventArgs> PointerMovedEvent
Field Value
PointerPressedEvent
Defines the PointerPressed event.
public static readonly RoutedEvent<PointerPressedEventArgs> PointerPressedEvent
Field Value
PointerReleasedEvent
Defines the PointerReleased event.
public static readonly RoutedEvent<PointerReleasedEventArgs> PointerReleasedEvent
Field Value
PointerWheelChangedEvent
Defines the PointerWheelChanged event.
public static readonly RoutedEvent<PointerWheelEventArgs> PointerWheelChangedEvent
Field Value
TabIndexProperty
Defines the TabIndex property.
public static readonly StyledProperty<int> TabIndexProperty
Field Value
TappedEvent
Defines the Tapped event.
public static readonly RoutedEvent<TappedEventArgs> TappedEvent
Field Value
TextInputEvent
Defines the TextInput event.
public static readonly RoutedEvent<TextInputEventArgs> TextInputEvent
Field Value
TextInputMethodClientRequestedEvent
Defines the TextInputMethodClientRequested event.
public static readonly RoutedEvent<TextInputMethodClientRequestedEventArgs> TextInputMethodClientRequestedEvent
Field Value
Properties
Cursor
Gets or sets associated mouse cursor.
public Cursor? Cursor { get; set; }
Property Value
Focusable
Gets or sets a value indicating whether the control can receive focus.
public bool Focusable { get; set; }
Property Value
GestureRecognizers
public GestureRecognizerCollection GestureRecognizers { get; }
Property Value
IsEffectivelyEnabled
Gets a value indicating whether this control and all its parents are enabled.
public bool IsEffectivelyEnabled { get; }
Property Value
Remarks
The IsEnabled property is used to toggle the enabled state for individual controls. The IsEffectivelyEnabled property takes into account the IsEnabled value of this control and its parent controls.
IsEnabled
Gets or sets a value indicating whether the control is enabled for user interaction.
public bool IsEnabled { get; set; }
Property Value
IsEnabledCore
Allows a derived class to override the enabled state of the control.
protected virtual bool IsEnabledCore { get; }
Property Value
Remarks
Derived controls may wish to disable the enabled state of the control without overwriting the user-supplied IsEnabled setting. This can be done by overriding this property to return the overridden enabled state. If the value returned from IsEnabledCore should change, then the derived control should call UpdateIsEffectivelyEnabled().
IsFocused
Gets a value indicating whether the control is focused.
public bool IsFocused { get; }
Property Value
IsHitTestVisible
Gets or sets a value indicating whether the control is considered for hit testing.
public bool IsHitTestVisible { get; set; }
Property Value
IsKeyboardFocusWithin
Gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements.
public bool IsKeyboardFocusWithin { get; }
Property Value
IsPointerOver
Gets a value indicating whether the pointer is currently over the control.
public bool IsPointerOver { get; }
Property Value
IsTabStop
Gets or sets a value that indicates whether the control is included in tab navigation.
public bool IsTabStop { get; set; }
Property Value
KeyBindings
Gets the key bindings for the element.
public List<KeyBinding> KeyBindings { get; }
Property Value
TabIndex
Gets or sets a value that determines the order in which elements receive focus when the user navigates through controls by pressing the Tab key.
public int TabIndex { get; set; }
Property Value
Methods
Focus(NavigationMethod, KeyModifiers)
Focuses the control.
public bool Focus(NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None)
Parameters
method
NavigationMethodThe method by which focus was changed.
keyModifiers
KeyModifiersAny key modifiers active at the time of focus.
Returns
OnAccessKey(RoutedEventArgs)
This method is used to execute the action on an effective IInputElement when a corresponding access key has been invoked. By default, the Focus() method is invoked with the NavigationMethod.Tab to indicate a visual focus adorner. Overwrite this method if other methods or additional functionality is needed when an item should receive the focus.
protected virtual void OnAccessKey(RoutedEventArgs e)
Parameters
e
RoutedEventArgsAccessKeyEventArgs are passed on to indicate if there are multiple matches or not.
OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
Calls the OnAttachedToVisualTree(VisualTreeAttachmentEventArgs) method for this control and all of its visual descendants.
protected override void OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs e)
Parameters
e
VisualTreeAttachmentEventArgsThe event args.
OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
Calls the OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs) method for this control and all of its visual descendants.
protected override void OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
Parameters
e
VisualTreeAttachmentEventArgsThe event args.
OnGotFocus(GotFocusEventArgs)
Called before the GotFocus event occurs.
protected virtual void OnGotFocus(GotFocusEventArgs e)
Parameters
e
GotFocusEventArgsThe event args.
OnKeyDown(KeyEventArgs)
Called before the KeyDown event occurs.
protected virtual void OnKeyDown(KeyEventArgs e)
Parameters
e
KeyEventArgsThe event args.
OnKeyUp(KeyEventArgs)
Called before the KeyUp event occurs.
protected virtual void OnKeyUp(KeyEventArgs e)
Parameters
e
KeyEventArgsThe event args.
OnLostFocus(RoutedEventArgs)
Called before the LostFocus event occurs.
protected virtual void OnLostFocus(RoutedEventArgs e)
Parameters
e
RoutedEventArgsThe event args.
OnPointerCaptureLost(PointerCaptureLostEventArgs)
Called before the PointerCaptureLost event occurs.
protected virtual void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
Parameters
e
PointerCaptureLostEventArgsThe event args.
OnPointerEntered(PointerEventArgs)
Called before the PointerEntered event occurs.
protected virtual void OnPointerEntered(PointerEventArgs e)
Parameters
e
PointerEventArgsThe event args.
OnPointerExited(PointerEventArgs)
Called before the PointerExited event occurs.
protected virtual void OnPointerExited(PointerEventArgs e)
Parameters
e
PointerEventArgsThe event args.
OnPointerMoved(PointerEventArgs)
Called before the PointerMoved event occurs.
protected virtual void OnPointerMoved(PointerEventArgs e)
Parameters
e
PointerEventArgsThe event args.
OnPointerPressed(PointerPressedEventArgs)
Called before the PointerPressed event occurs.
protected virtual void OnPointerPressed(PointerPressedEventArgs e)
Parameters
e
PointerPressedEventArgsThe event args.
OnPointerReleased(PointerReleasedEventArgs)
Called before the PointerReleased event occurs.
protected virtual void OnPointerReleased(PointerReleasedEventArgs e)
Parameters
e
PointerReleasedEventArgsThe event args.
OnPointerWheelChanged(PointerWheelEventArgs)
Called before the PointerWheelChanged event occurs.
protected virtual void OnPointerWheelChanged(PointerWheelEventArgs e)
Parameters
e
PointerWheelEventArgsThe event args.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
OnTextInput(TextInputEventArgs)
Called before the TextInput event occurs.
protected virtual void OnTextInput(TextInputEventArgs e)
Parameters
e
TextInputEventArgsThe event args.
UpdateIsEffectivelyEnabled()
Updates the IsEffectivelyEnabled property value according to the parent control's enabled state and IsEnabledCore.
protected void UpdateIsEffectivelyEnabled()
Events
DoubleTapped
Occurs when a double-tap gesture occurs on the control.
public event EventHandler<TappedEventArgs>? DoubleTapped
Event Type
GotFocus
Occurs when the control receives focus.
public event EventHandler<GotFocusEventArgs>? GotFocus
Event Type
Holding
Occurs when a hold gesture occurs on the control.
public event EventHandler<HoldingRoutedEventArgs>? Holding
Event Type
KeyDown
Occurs when a key is pressed while the control has focus.
public event EventHandler<KeyEventArgs>? KeyDown
Event Type
KeyUp
Occurs when a key is released while the control has focus.
public event EventHandler<KeyEventArgs>? KeyUp
Event Type
LostFocus
Occurs when the control loses focus.
public event EventHandler<RoutedEventArgs>? LostFocus
Event Type
PointerCaptureLost
Occurs when the control or its child control loses the pointer capture for any reason, event will not be triggered for a parent control if capture was transferred to another child of that parent control
public event EventHandler<PointerCaptureLostEventArgs>? PointerCaptureLost
Event Type
PointerEntered
Occurs when the pointer enters the control.
public event EventHandler<PointerEventArgs>? PointerEntered
Event Type
PointerExited
Occurs when the pointer leaves the control.
public event EventHandler<PointerEventArgs>? PointerExited
Event Type
PointerMoved
Occurs when the pointer moves over the control.
public event EventHandler<PointerEventArgs>? PointerMoved
Event Type
PointerPressed
Occurs when the pointer is pressed over the control.
public event EventHandler<PointerPressedEventArgs>? PointerPressed
Event Type
PointerReleased
Occurs when the pointer is released over the control.
public event EventHandler<PointerReleasedEventArgs>? PointerReleased
Event Type
PointerWheelChanged
Occurs when the mouse is scrolled over the control.
public event EventHandler<PointerWheelEventArgs>? PointerWheelChanged
Event Type
Tapped
Occurs when a tap gesture occurs on the control.
public event EventHandler<TappedEventArgs>? Tapped
Event Type
TextInput
Occurs when a user typed some text while the control has focus.
public event EventHandler<TextInputEventArgs>? TextInput
Event Type
TextInputMethodClientRequested
Occurs when an input element gains input focus and input method is looking for the corresponding client
public event EventHandler<TextInputMethodClientRequestedEventArgs>? TextInputMethodClientRequested