如何通过WPF中的代码转到flowdocument阅读器中的特定页码?
流程文档阅读器中有一个 pagenumber 属性。但该属性是只读的。有什么方法可以转到流程文档阅读器中的特定页码。请帮忙。
谢谢。
There is a pagenumber property in flowdocument reader.But that property is readonly. Is there any way to goto particular page number in flowdocument reader.Please help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您愿意限制用户分页显示,请改用 FlowDocumentPageViewer:它有一个 GoToPage() 方法。由于某种原因,FlowDocumentReader 似乎没有提供 GoToPage();我猜这是因为 FlowDocumentReader 并不总是处于有意义的分页模式(用户可以选择连续滚动视图),并且在有意义时为此提供自己的 UI。
您可以尝试向其发送 NavigationCommands.GoToPage 命令,但这仅记录为适用于 FlowDocumentPageViewer 和 DocumentViewer;我还没有在 FlowDocumentReader 上测试过它。
If you are willing to restrict your users to paged display, use FlowDocumentPageViewer instead: this has a GoToPage() method. For some reason GoToPage() doesn't seem to be offered on FlowDocumentReader; I'd guess this is because FlowDocumentReader isn't always in a mode where paging is meaningful (the user can select a continuous scrolling view), and provides its own UI for this when it is meaningful.
You could try sending it the NavigationCommands.GoToPage command, but this is only documented as working on FlowDocumentPageViewer and DocumentViewer; I haven't tested it on FlowDocumentReader.
如果您跟踪 FlowDocumentReader 中包含的 FlowDocument 上的块,
比您可以简单地使用:
这仅适用于 FlowDocumentReader 的 ViewingModes 页面。
如果您想在滚动模式下执行此操作,则必须沿着视觉树向下搜索 ScrollViewer,
像这样的东西:
If you keep track of the Blocks on the FlowDocument contained in the FlowDocumentReader,
than you can simply use:
This works only on the page ViewingModes of the FlowDocumentReader.
if you whould like to do so on the scroll mode, you must go down the visual tree and search for the ScrollViewer,
somthing like this: