本文介绍了WPF,如何使文本在字符串中变为粗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个WPF应用程序. Introtext有一个键,例如"My name is John".来自静态资源文件"EmployeeResources.resx".
我想将字符串显示为我的名字是约翰". (必须为粗体),如下文所述.
<b; StackPanel Orientation =垂直"; Grid.Column ="2">
< TextBlock Text =" {x:静态名称:EmployeeResources.Introtext}" />
</StackPanel>
我如何实现这一目标.
解决方案
I have a WPF application. There is a key as Introtext as "My name is John" which is coming from the static resource file "EmployeeResources.resx".
I want to display string as "My name is John" (Is must be bold) in a SINGLE textblock as mention below.
<StackPanel Orientation="Vertical" Grid.Column="2">
<TextBlock Text="{x:Static name:EmployeeResources.Introtext}" />
</StackPanel>
How can I achieve this.
解决方案
这篇关于WPF,如何使文本在字符串中变为粗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!