WPF: Button mnemonic does not work if placing the

2019-03-28 18:32发布

If I place a Button within a ToolBar in WPF:

<ToolBar FocusManager.IsFocusScope="False"  Grid.Row="1" Name="tools"
         DataContext="{Binding Path=WeekNavigator}">
    <Button Content="_>" Command="{Binding Path=CommandNavigateToNextWeek}"/>
</ToolBar>

The text of the button displays "_>" instead of just ">" and the mnemonic doesn't work. If I move the Button outside of the ToolBar it works as expected.

How can I get the button to behave the same way inside a toolbar (with regards to mnemonics) as outside of one?

1条回答
劫难
2楼-- · 2019-03-28 19:06

Try this:

<ToolBar>
    <Button>
        <AccessText>_></AccessText>
    </Button>
</ToolBar>
查看更多
登录 后发表回答