简体   繁体   中英

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.

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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