简体   繁体   English

如何为Ribbonbutton标签的字符加下划线?

[英]how to underline a character of ribbonbutton label?

Is there any way to make a character of ribbon button's label property to underline(underscore) in c# in order to show the access key without using the key tip property. 是否有任何方法可以使带状按钮的标签属性的字符在c#中加下划线(下划线),以便在不使用键尖属性的情况下显示访问键。

Eg: If it's a save button then the ribbon button label must be like Save with an underscore or underline below S. 例如:如果它是一个保存按钮,那么带状按钮标签必须类似于下面用下划线或下划线保存。

You can use Underline in a TextBlock : 您可以在TextBlock使用Underline

<TextBlock Name="textBlockSave">
  <Underline>S</Underline>ave
</TextBlock>

or, 要么,

textBlockSave.Inlines.Add(new Underline(new Run("S")));
textBlockSave.Inlines.Add(new Run("ave"));

Add this textblock textBlockSave as Button Content. 将此文本块textBlockSave添加为Button Content。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM