dotnet / dotnet/wpf

[WPF] KeyGesture.GetDisplayStringForCulture() does not provide a localized string

Open
#10,894 1 comment 4 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/WPF-KeyGestureGetDisplayStringForCult/10908265)._

---
[severity:It's more difficult to complete my work]
Contrary to what its name suggests, the function `GetDisplayStringForCulture(CultureInfo)` in the class `System.Windows.Input.KeyGesture` does not return a localized string.
After looking into the source code, the problem can be tracked down to the `ConvertTo(ITypeDescriptorContext, CultureInfo, object, Type)` method of the `System.Windows.Input.KeyConverter` class, which does not use its `CultureInfo` parameter.

Workaround (not ideal): use WinForms, as suggested by this [StackOverflow answer](https://stackoverflow.com/a/19947904/3220898). This works because `System.Windows.Forms.KeysConverter` properly translates the special keys.

---
### Original Comments

#### Feedback Bot on 5/22/2025, 11:33 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.