6

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?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Marius
  • 9,208
  • 8
  • 50
  • 73

1 Answers1

8

Try this:

<ToolBar>
    <Button>
        <AccessText>_></AccessText>
    </Button>
</ToolBar>
John Bowen
  • 24,213
  • 4
  • 58
  • 56
  • perfect! i was hoping the _ to work with the content attribute of a button! xaml always surprises me while learning! – ioWint Aug 02 '11 at 22:38