如何使所有文本大写/大写? [英] How to make all text upper case / capital?
本文介绍了如何使所有文本大写/大写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望 TextBlock
、Label
、MenuItem.Header
中的所有文本都以大写形式显示.字符串取自 ResourceDictionary
例如:
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}"/>
等等.(也适用于 Label
和其他控件)
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.
推荐答案
你仍然可以使用转换器,只需在绑定的源中设置 textvalue :
You still can use a converter, just set the textvalue in the source of the binding :
<TextBlock Text="{Binding Source={StaticResource String1}, Converter ={StaticResource myConverter}}"/>
这篇关于如何使所有文本大写/大写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文