WPF DocumentViewer 查找功能和固定页面文档
.Net 包含一个名为 DocumentViewer
。 它还提供了一个子控件,用于在加载的文档中查找文本(这至少是它应该做的)。
插入 FixedPage
的对象作为 DocumentViewer
的文档源,查找功能只是找不到任何内容。 连一个字母都没有。 我还没有尝试过 FlowDocument
还没有, 由于 DocumentViewer
的文档不太有用,而且网上的资源实际上并不存在,我现在想问 stackoverflow 社区:
需要什么才能获得 WPF 的 Find-Function < code>DocumentViewer 是否可以使用 FixedPage
文档?
[顺便说一句,我不为 DocumentViewer
使用自定义 ControlTemplates
]
.Net contains a nice control called DocumentViewer
. it also offers a subcontrol for finding text in the loaded document (that's at least what it is supposed to do).
When inserting FixedPage
's objects as document source for the DocumentViewer
, the find-functionality just does not find anything. Not even single letters. I haven't tried FlowDocument
's yet,
as the documentation for DocumentViewer
is not that useful and the resources on the net are not actually existing, I now want to ask the stackoverflow community:
What does it need to get the Find-Function of the WPF DocumentViewer
working with FixedPage
documents?
[btw, I don't use custom ControlTemplates
for DocumentViewer
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在使用固定文档时也遇到了同样的问题。 如果您将固定文档转换为 XPS 文档,则它可以正常工作。
从固定文档在内存中创建 XPS 文档然后在文档查看器中显示的示例。
I had this same problem with FixedDocuments. If you convert your FixedDocument to an XPS document then it works fine.
Example of creating an XPS Document in memory from a FixedDocument then displaying in a DocumentViewer.
我在 RichTextBox 中搜索文本时遇到问题,速度太慢。 我所做的就是每次想要搜索时都对 xaml 进行处理。 我提高了几个数量级。
这是一个很大的解决方法,基于 Chris Anderson 的书的一部分。
干杯
I had trouble with searching text in richtextbox, it was too slow. What I did was crunch the xaml every time I wanted to search. I improved several orders of magnitude.
It's a big workaround based in a part of the Chris Anderson's book.
Cheers