Table of Contents

Interface IInputElement

Namespace
Avalonia.Input
Assembly
Avalonia.Base.dll

Defines input-related functionality for a control.

[NotClientImplementable]
public interface IInputElement
Extension Methods

Properties

Cursor

Gets or sets the associated mouse cursor.

Cursor? Cursor { get; }

Property Value

Cursor

Focusable

Gets or sets a value indicating whether the control can receive keyboard focus.

bool Focusable { get; }

Property Value

bool

IsEffectivelyEnabled

Gets a value indicating whether this control and all its parents are enabled.

bool IsEffectivelyEnabled { get; }

Property Value

bool

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.

IsEffectivelyVisible

Gets a value indicating whether this control and all its parents are visible.

bool IsEffectivelyVisible { get; }

Property Value

bool

IsEnabled

Gets or sets a value indicating whether the control is enabled for user interaction.

bool IsEnabled { get; }

Property Value

bool

IsFocused

Gets a value indicating whether the control is focused.

bool IsFocused { get; }

Property Value

bool

IsHitTestVisible

Gets a value indicating whether the control is considered for hit testing.

bool IsHitTestVisible { get; }

Property Value

bool

IsKeyboardFocusWithin

Gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements.

bool IsKeyboardFocusWithin { get; }

Property Value

bool

IsPointerOver

Gets a value indicating whether the pointer is currently over the control.

bool IsPointerOver { get; }

Property Value

bool

KeyBindings

Gets the key bindings for the element.

List<KeyBinding> KeyBindings { get; }

Property Value

List<KeyBinding>

Methods

AddHandler(RoutedEvent, Delegate, RoutingStrategies, bool)

Adds a handler for the specified routed event.

void AddHandler(RoutedEvent routedEvent, Delegate handler, RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, bool handledEventsToo = false)

Parameters

routedEvent RoutedEvent

The routed event.

handler Delegate

The handler.

routes RoutingStrategies

The routing strategies to listen to.

handledEventsToo bool

Whether handled events should also be listened for.

Focus(NavigationMethod, KeyModifiers)

Focuses the control.

bool Focus(NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None)

Parameters

method NavigationMethod

The method by which focus was changed.

keyModifiers KeyModifiers

Any key modifiers active at the time of focus.

Returns

bool

RaiseEvent(RoutedEventArgs)

Raises a routed event.

void RaiseEvent(RoutedEventArgs e)

Parameters

e RoutedEventArgs

The event args.

RemoveHandler(RoutedEvent, Delegate)

Removes a handler for the specified routed event.

void RemoveHandler(RoutedEvent routedEvent, Delegate handler)

Parameters

routedEvent RoutedEvent

The routed event.

handler Delegate

The handler.

Events

GotFocus

Occurs when the control receives focus.

event EventHandler<GotFocusEventArgs>? GotFocus

Event Type

EventHandler<GotFocusEventArgs>

KeyDown

Occurs when a key is pressed while the control has focus.

event EventHandler<KeyEventArgs>? KeyDown

Event Type

EventHandler<KeyEventArgs>

KeyUp

Occurs when a key is released while the control has focus.

event EventHandler<KeyEventArgs>? KeyUp

Event Type

EventHandler<KeyEventArgs>

LostFocus

Occurs when the control loses focus.

event EventHandler<RoutedEventArgs>? LostFocus

Event Type

EventHandler<RoutedEventArgs>

PointerEntered

Occurs when the pointer enters the control.

event EventHandler<PointerEventArgs>? PointerEntered

Event Type

EventHandler<PointerEventArgs>

PointerExited

Occurs when the pointer leaves the control.

event EventHandler<PointerEventArgs>? PointerExited

Event Type

EventHandler<PointerEventArgs>

PointerMoved

Occurs when the pointer moves over the control.

event EventHandler<PointerEventArgs>? PointerMoved

Event Type

EventHandler<PointerEventArgs>

PointerPressed

Occurs when the pointer is pressed over the control.

event EventHandler<PointerPressedEventArgs>? PointerPressed

Event Type

EventHandler<PointerPressedEventArgs>

PointerReleased

Occurs when the pointer is released over the control.

event EventHandler<PointerReleasedEventArgs>? PointerReleased

Event Type

EventHandler<PointerReleasedEventArgs>

PointerWheelChanged

Occurs when the mouse wheel is scrolled over the control.

event EventHandler<PointerWheelEventArgs>? PointerWheelChanged

Event Type

EventHandler<PointerWheelEventArgs>

TextInput

Occurs when a user typed some text while the control has focus.

event EventHandler<TextInputEventArgs>? TextInput

Event Type

EventHandler<TextInputEventArgs>