Replies: 0 comments 4 replies
-
Hello, 'dgellow! Thanks for submitting a new feature request. I've automatically added a vote 👍 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future! |
Beta Was this translation helpful? Give feedback.
-
Open questions:
|
Beta Was this translation helpful? Give feedback.
-
@chingucoding WinUI 2 doesn't really have public helpers and only controls. Thoughts on if it'd be useful to try and do something there or would they only consider it for WinUI 3? Otherwise, it's easy enough for us to find a spot in the Toolkit for us on the managed side and expose it in a compatible way with WinUI 3 for future migrations. |
Beta Was this translation helpful? Give feedback.
-
WinUI already exposes a few converters, however those always were born out of a need in a specific control. Having this inside WinUI 2 would be really cool, however I'm not sure how inline it is with the plan for WinUI 2 as a product. @ranjeshj @SavoySchuler @MikeHillberg what do you think about this? Having this inside the WCT seems the easiest, however I am not sure about C++\WinRT folks though. Having this inside WinUI would be better though. We can try, but I am not sure where it would be or how it would fit in the product its self. |
Beta Was this translation helpful? Give feedback.
-
Describe the problem this feature would solve
Problem originally reported via CommunityToolkit/WindowsCommunityToolkit#4008.
To set the context, three points:
AltGr
is equivalent to pressing down the keysAltLeft
andControl
at the same time (both key are consideredDown
).AltGr
is generally used by non-US keyboard layouts to write special characters (for example the German keyboard usesAltGr+q
to emit the character "@").Control+<key>
Because of this, naive code such as the following may fail to distinguish a between a situation where the user tries to write a special character, and where they want to invoke a shortcut:
With this logic every time a user with a German layout will try to write the character "@" (i.e
AltGr+q
) they will instead performDoSomething()
.A correct way to check for shortcuts is by ensuring that
AltLeft
(calledMenuLeft
in the Windows lingo) is not pressed, butControl
is:Of course that's tedious to do and very easy to forget.
Describe the solution
My opinion is that a simple helper
IsShortcutKeyDown
(the exact name and implementation are to be defined) would ensure that shortcuts are implemented correctly, without conflicts with user keyboard layouts:Whenever a developer wants to check if the user is invoking a shortcut they should use this helper instead of manually checking for
Control
being down.Our example becomes:
Describe alternatives you've considered
Additional context & Screenshots
Initially reported and discussed in #4008, more contextual details can be found there.
Beta Was this translation helpful? Give feedback.
All reactions