由于某种原因,我无法在 WPF 中使用 TextFlow 元素。这个元素/控件甚至可用吗?
我正在使用 VS 2008。
如果要避免 FlowDocument 的默认 chrome,可以自己指定查看器:
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph>
<Run>Hello</Run>
<Run Background="Yellow">World</Run>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
没有 TextFlow 元素。您在寻找 FlowDocument 吗?
<ContentControl>
<FlowDocument>
<Paragraph>
<Run>Hello</Run>
<Run Background="Yellow"> World</Run>
</Paragraph>
</FlowDocument>
</ContentControl>
您还可以使用 TextBlock:
<TextBlock><Run>Hello</Run><Run Background="Yellow">World</Run></TextBlock>