如何使所有的文本大写/大写? [英] How to make all text upper case / capital?
问题描述
我想在 TextBlock
,标签
, MenuItem.Header
以大写显示。
字符串取自 ResourceDictionary
例如:
pre $ < TextBlock Text ={StaticResource String1}/>
< MenuItem Header ={StaticResource MenuItemDoThisAndThat}/>
等。 (也用于标签
和其他控件)
我无法使用值转换器,因为没有绑定。我不想在字典本身的字符串大写。
你仍然可以使用转换器,只是设置绑定源文本值:
pre $ < TextBlock Text ={Binding Source = {StaticResource String1},Converter = {StaticResource myConverter}}/>
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.
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屋!