-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
area-gesturesGesture typesGesture typesproposal/opent/enhancement ☀️New feature or requestNew feature or request
Milestone
Description
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
SarthakB26, thomaskaelin, YZahringer, lettucrisp, jeremy-visionaid and 5 moreSarthakB26 and tonyedwardspz
Metadata
Metadata
Assignees
Labels
area-gesturesGesture typesGesture typesproposal/opent/enhancement ☀️New feature or requestNew feature or request