VS编程,WPF单独更改TextBlock中部分文字格式的一种方法

版权声明:我不生产代码,我只是代码的搬运工。 https://blog.csdn.net/qq_43307934/article/details/82966473

有时候需要更改一长串文本中的单独的几个文字格式,这里提供了一种方法。

效果: 

1、前台使用 TextBlock控件,利用Run元素

<TextBlock FontSize="26"
           HorizontalAlignment="Center"
           VerticalAlignment="Center"  >
           单独更改
           <Run Foreground="Blue"  FontSize=" 38" TextDecorations="underline" Text=" 文本 " /> 
           这两个字的格式
</TextBlock>

猜你喜欢

转载自blog.csdn.net/qq_43307934/article/details/82966473