views:

18

answers:

1

I am setting the .Content value of a Button to a string that contains underscores; the first underscore is being interpreted as an accelerator key.

Without changing the underlying string (by replacing all _ with __), is there a way to disable the accelerator for non-menu Buttons?

+1  A: 

One easy way is to embed your string in a TextBlock (which has no concept of an access key) and use that as the content of your button instead of the raw string:

<Button><TextBlock Text="{Binding TextWithUnderscore}" /></Button>
Matt Hamilton
Thank you for your help.
Gerry