How to make all text upper case / capital?

2019-01-18 01:36发布

I want all texts in TextBlock, Label, MenuItem.Header to be displayed in upper case. The strings are taken from a ResourceDictionary e.g.:

<TextBlock Text="{StaticResource String1}"/>
<MenuItem Header="{StaticResource MenuItemDoThisAndThat}"/>

etc. (also for Label and other controls)

I cannot use a value converter because there is no binding. I don't want to make the strings upper case in the dictionary itself.

7条回答
疯言疯语
2楼-- · 2019-01-18 02:24

Rather than using a converter, you can use the tag CharacterCasing in a TextBox but in your case, it doesn't work on a TextBlock.

<TextBox CharacterCasing="Upper" Text="{StaticResource String1}" />
查看更多
登录 后发表回答