-
Notifications
You must be signed in to change notification settings - Fork 9
Windows - Enable preview events #9
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
base: main
Are you sure you want to change the base?
Conversation
UPDATE: Pass-through 'Handled' state on windows to source event
UPDATE: KeyboardKeys aren't [Flags] UPDATE: KeyPressedEventArgs don't support multiple keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Plugin.Maui.KeyListener/KeyboardKeysExtensions.cs:41
- [nitpick] The mapping for KeyboardKeys.N returns an uppercase 'N' while most mappings use lowercase letters; it might be more consistent to return 'n' unless the uppercase is intentional.
KeyboardKeys.N => 'N',
private List<Guid> _boundIds = [Guid.Empty]; | ||
|
Copilot
AI
Apr 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialization of _boundIds using [Guid.Empty] is not valid C# syntax; consider changing it to 'new List { Guid.Empty }' if the intention is to start with a default value, or initialize an empty list if no default is required.
private List<Guid> _boundIds = [Guid.Empty]; | |
private List<Guid> _boundIds = new List<Guid> { Guid.Empty }; |
Copilot uses AI. Check for mistakes.
@bengavin I realize it's been a bit here But what's the motivation for wiring into Preview events? What problem are you solving here? |
In our case we needed to capture input from a barcode scanner without having the user need to have focus on an input field. The preview events seemed to be the only way on windows to accomplish this, and it was still relatively unreliable if the screen was clicked on in an area that also handled keyboard events. |
This updates the library to support binding to the 'Preview' events on Windows. It also works around a bug where the behavior can be attached multiple times to the same bindable without intervening Detached events [currently a bug in the CommunityToolkit PopupService, see: https://github.com/CommunityToolkit/Maui/issues/1912 ].
Also does some general cleanup: