我是 C# Wpf 的初学者,我想通过编程制作一个带有少量段落的流文档。问题是段落之间有很大的空间,我想将其调整到最小。
我通过使用 Xml 语句找到了解决方案,但我想通过编程来实现:
<FlowDocument>
<FlowDocument.Resources>
<!-- This style is used to set the margins for all paragraphs in the FlowDocument to 0. -->
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"/>
</Style>
</FlowDocument.Resources>
<Paragraph>
Spacing between paragraphs is caused by margins set on the paragraphs. Two adjacent margins
will "collapse" to the larger of the two margin widths, rather than doubling up.
</Paragraph>
<Paragraph>
To eliminate extra spacing between two paragraphs, just set the paragraph margins to 0.
</Paragraph>
</FlowDocument>
我该怎么做 ?。
谢谢你的帮助。