Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WiP] KeyboardGestureRecognizers #16217

Open
Tracked by #16799 ...
PureWeen opened this issue Jul 18, 2023 · 1 comment
Open
Tracked by #16799 ...

[WiP] KeyboardGestureRecognizers #16217

PureWeen opened this issue Jul 18, 2023 · 1 comment
Labels
area-gestures Gesture types proposal/open t/enhancement ☀️ New feature or request
Milestone

Comments

@PureWeen
Copy link
Member

Description

Enable Keyboard scenarios for custom controls built on top of .NET MAUI.

(Public) API Changes

KeyboardGestureRecognizer

Allow users to react to keyboard events.

Properties

Events

API Description
KeyUp Indicates a KeyUp event is being processed by the given control
KeyDown Indicates a KeyDown event is being processed by the given control
PreviewKeyUp Indicates a KeyUp event is going to happen to a given control. This is the place where you would intercept and redirect a KeyUp event before it happens
PreviewKeyDown Indicates a KeyDown event is going to happen to a given control. This is the place where you would intercept and redirect a KeyDown event before it happens

KeyboardEventArgs

Properties

API Description
Handled When this is marked as true the operating system will stop bubbling this event
Key What is the key that triggered this event

Usage Scenarios

Simple XAML Example

<StackPanel.GestureRecognizers>
  <KeyboardGestureRecognizer KeyDown="OnKeyDown"></KeyboardGestureRecognizer>
</StackPanel.GestureRecognizers>

Modify how arrow keys work

<StackPanel.GestureRecognizers>
  <KeyboardGestureRecognizer PreviewKeyDown="OnPreviewKeyDown"></KeyboardGestureRecognizer>
</StackPanel.GestureRecognizers>
void OnPreviewKeyDown(object sender, KeyboardEventArgs args)
{
    if (args.Key == VirtualKeys.Up)
         args.Handled = true;
}

Backward Compatibility

N/A

Difficulty

High

@ghost
Copy link

ghost commented Aug 3, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-gestures Gesture types proposal/open t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants