如何使所有的文本大写/大写? [英] How to make all text upper case / capital?

查看:268
本文介绍了如何使所有的文本大写/大写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆