FlowDocument - 如何实现 KeepWithNext
我有一个 FlowDocument,其中包含多个彼此背靠背的 BlockUIContainer。这些 UIContainer 各自代表来自不同来源的不同类型的内容,但都是相关的,我希望它们在页面上保持在一起。换句话说,我不希望它们在页面之间分开。
Paragraph 类有一个名为 KeepWithNext 的属性,该属性将确保其后面的段落始终与给定段落保持在同一页面上。
我想将此功能添加到 BlockUIContainer(或子类 BlockUIContainer 来添加它),但我不知道如何将 KeepWithNext 属性用于 Paragraph 类。
我尝试使用 Reflector 来获得一些见解,但据我所知,它只是一个布尔属性,在 Paragraph 类中没有实际用途。这让我相信分页器以某种方式知道如何处理该属性。
有谁知道我应该如何处理这个问题?我应该在哪里查找我需要做什么来匹配段落功能?
I have a FlowDocument with multiple BlockUIContainers back to back with one another. These UIContainers each represent a different type of content coming from a different source, but are all related and I would like them to stay together on a page. To word it differently, I don't want them split between pages.
The Paragraph class has a property called KeepWithNext that will make sure that the paragraph that follows it always stays on the same page as the given paragraph.
I would like to add this functionality to the BlockUIContainer (or subclass BlockUIContainer to add it) but I don't know how the KeepWithNext property gets used for the Paragraph class.
I've tried using Reflector to get some insight, but as far as I can tell it's just a boolean property with no real usage inside of the Paragraph class. This leads me to believe that the paginator somehow knows what to do with the property.
Does anyone have a clue about how I should approach this? Where should I look to find out what I need to do to match the Paragraph functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定内部分页是如何工作的,但是...
与扩展
BlockUIContainer
不同,使用Paragraph 上现有的
并将您的KeepWithNext
属性可能会更容易BlockUIContainers
转换为Paragraphs
内的InlineUIContainers
。I'm not sure how the internal pagination works, but...
Instead of extending
BlockUIContainer
, it may be much easier to use the existingKeepWithNext
property onParagraph
and convert yourBlockUIContainers
toInlineUIContainers
insideParagraphs
.