WPF呈现文本的控件有 TextBlock,Label ,TextBox, RichTextBox 等等!
下面我们还是以呈现Hello World加以说明。
1.显示不同的样式的文本
代码:
<WrapPanel Orientation="Vertical">
<TextBlock>Hello World</TextBlock>
<TextBlock Margin="2">
<Run Foreground="Blue">Hello</Run>
<Run Foreground="Red">World</Run>
</TextBlock>
</WrapPanel>
效果图: