-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[API Proposal]: Public the ScanCode property in KeyEventArgs #8473
Labels
API suggestion
Early API idea and discussion, it is NOT ready for implementation
Comments
lindexi
added
the
API suggestion
Early API idea and discussion, it is NOT ready for implementation
label
Nov 29, 2023
6 tasks
Few things:
|
For 1. var key = e.Key;
var virtualKey = KeyInterop.VirtualKeyFromKey(key);
// MAPVK_VK_TO_VSC 0
var scanCode = MapVirtualKeyW((uint) virtualKey, 0);
var scanCodeFromWpf = typeof(KeyEventArgs).GetProperty("ScanCode", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(e);
Debug.Assert(scanCode == (int) scanCodeFromWpf!);
[DllImport("User32.dll")]
private static extern uint MapVirtualKeyW(uint code, uint mapType); |
lindexi
added a commit
to lindexi/lindexi_gd
that referenced
this issue
Apr 30, 2024
Merged
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background and motivation
As unoplatform/uno#14371 (comment) , the UNO for WPF will use reflection to get the ScanCode property in KeyEventArgs.
And the ScanCode property in KeyEventArgs is useful in many businesses code or framework code.
This property is rarely used in WPF today.
The code to get the ScanCode (only ways) :
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSource.cs
Line 2362 in 187be47
The code to use ScanCode (only ways) :
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/TextCompositionManager.cs
Line 435 in 187be47
API Proposal
Or
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: