[API Proposal]: Public the ScanCode property in KeyEventArgs
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Background and motivation
As https://github.com/unoplatform/uno/pull/14371#discussion_r1407800681 , 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) : https://github.com/dotnet/wpf/blob/187be47c5554d4745e9b17385889a8086d6e4286/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSource.cs#L2362
The code to use ScanCode (only ways) : https://github.com/dotnet/wpf/blob/187be47c5554d4745e9b17385889a8086d6e4286/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/TextCompositionManager.cs#L435
### API Proposal
```csharp
public class KeyEventArgs
{
public int ScanCode { get; internal set; }
}
```
Or
```csharp
public class KeyEventArgs
{
public int ScanCode { get; set; }
}
```
### API Usage
```csharp
KeyEventArgs args = ...;
var scanCode = args.ScanCode.
```
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.