Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将 Button 的 .Content 值设置为包含下划线的字符串;第一个下划线被解释为加速键。
在不更改底层字符串(通过将所有 _ 替换为 __)的情况下,有没有办法禁用非菜单按钮的加速器?
一种简单的方法是将您的字符串嵌入到 TextBlock (没有访问密钥的概念)中,并将其用作按钮的内容而不是原始字符串:
<Button><TextBlock Text="{Binding TextWithUnderscore}" /></Button>