Skip to content

Button style not recognizing access key #1495

@RichardD2

Description

@RichardD2

Describe the bug

Buttons do not recognize the access key from their assigned content.

To Reproduce

  1. Add a button - either a built-in button or a UI button.
  2. Assign its content to a string which includes an access key - for example, "_OK".
  3. Run the application.

Expected behavior

The button should display the text OK, and recognize the "O" as the access key.

Screenshots

The button displays the text verbatim, including the underscore:

Image

OS version

Windows 11 24H2

.NET version

.NET Framework 4.8

WPF-UI NuGet version

4.0.3

Additional context

The button styles need to set RecognizesAccessKey="True" on the ContentPresenter elements.

The current workaround is to add a global override to the application styles:

<Style TargetType="{x:Type ContentPresenter}">
    <Setter Property="RecognizesAccessKey" Value="True" />
</Style>
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions