3

I read that in order to enable mnemonics, I have to turn on RecognizesAccessKey on ContentPresenter.
When I tried this code, I saw only text without button.

<Button x:Name="OkButton" Content="_OK" Command="{Binding ExecuteCommand}">
    <Button.Template>
        <ControlTemplate TargetType="Button">
            <ContentPresenter RecognizesAccessKey="True" />
        </ControlTemplate>
    </Button.Template>
</Button>

Probably there's a way to change it without deleting button's default template?

Andrey
  • 853
  • 9
  • 27

1 Answers1

5

This question provides the answer, altough it's not exactly the same question. Here's how the mnemonic is set and working:

<Button>
    <AccessText>_Button</AccessText>
</Button>

Like in WinForms this is done by adding a _ before the character to be the mnemonic key.

Community
  • 1
  • 1
Abbas
  • 14,186
  • 6
  • 41
  • 72