How to add alphabet access key to a Button with Chinese content?

William Liu 466 Reputation points
2024-06-20T08:22:42.4966667+00:00

I read from MSDN that I can use the following XAML code to add access key to a Button.

<Button Click="edit_Click">
  <AccessText>_Edit</AccessText>
</Button>
<Button Click="cut_Click">_Cut</Button>

My question is, if the button's only content is '编辑', but I would like to use alt+e as the shortcut to access this button. Is it able to do so?

Thanks!

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
0 comments No comments
{count} votes

Accepted answer
  1. gekka 9,666 Reputation points MVP
    2024-06-20T09:28:13.7266667+00:00
    <Button Click="Button_Click">
        <AccessText Text="编辑(_E)" />
    </Button>
    

    or

    <Button Click="Button_Click">
        <Grid>
            <AccessText Opacity="0">_E</AccessText>
            <TextBlock Text="编辑" />
        </Grid>
    </Button>
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.