WPF: Button mnemonic does not work if placing the button in a toolbar

岁酱吖の 提交于 2019-12-04 23:10:20

问题


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:


Try this:

<ToolBar>
    <Button>
        <AccessText>_></AccessText>
    </Button>
</ToolBar>


来源:https://stackoverflow.com/questions/2186738/wpf-button-mnemonic-does-not-work-if-placing-the-button-in-a-toolbar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!