Skip to content

fix(controls): enable access key support for multiple WPFUI controls#1598

Merged
pomianowski merged 1 commit intolepoco:mainfrom
apachezy:fix/controls-accesskey
Dec 9, 2025
Merged

fix(controls): enable access key support for multiple WPFUI controls#1598
pomianowski merged 1 commit intolepoco:mainfrom
apachezy:fix/controls-accesskey

Conversation

@apachezy
Copy link
Contributor

@apachezy apachezy commented Dec 6, 2025

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

I observed that buttons in the WPFUI library lack access key functionality because the ContentPresenter in their templates is missing the RecognizesAccessKey property. For example, the "S" in "_Save" cannot be recognized as an access key.

Upon investigation, I found that the following controls also have similar issues:

  • RepeatButton
  • RadioButton
  • ToggleButton
  • ToggleSwitch (although it has ON/OFF content, it prioritizes the Content property when specified)
  • DropDownButton
  • HyperlinkButton
  • NavigationViewItem (all five variants)

Issue Number: N/A

What is the new behavior?

I have added RecognizesAccessKey="True" to the ContentPresenter in these control templates. These controls can now correctly recognize access key prefixes in their Content and set the associated characters as quick access keys. When the Alt key is pressed, the underline marking the access key becomes visible:

(When Alt is pressed)
AccessKey

Other information

While Windows native access key functionality supports a broader range of controls (such as ListItem), I believe the current fixes are sufficient for most use cases. If specific requirements arise in the future, further improvements can be made.

Note: The AutoSuggestBox within NavigationView currently treats access key prefixes as literal text when recognizing content. This PR does not include targeted improvements for this behavior.

@apachezy apachezy requested a review from pomianowski as a code owner December 6, 2025 07:46
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request navigation Changes to navigation related controls. release labels Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. navigation Changes to navigation related controls. PR Pull request release styles Topic is related to styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants