更改 WPF DocumentViewer 查看模式
您好,我遇到了一个问题,当我添加
时,我会得到一个工具栏,允许我更改 XPS 文档的查看模式,例如这里:
但是我如何以编程方式执行此操作? 我找不到任何可以执行此操作的属性,MSDN 和 Google 也没有提及此功能。 然后我发现 FlowDocumentReader 控件具有 ViewingMode 属性,但它无法显示 XPS 文档。我不敢相信这是不可能做到的,我的意思是该功能默认可用,我只想以编程方式更改它......
Hello I've got the problem that when I just add a <DocumentViewer x:Name="docViewer" />
I get a toolbar what allow me to change the viewing mode of the XPS document like here:
But how can I do this programmatically?
I cant find any property that do this and the MSDN and Google say nothing about this feature.
Then I found the FlowDocumentReader
control what have a ViewingMode
property, however it can't display a XPS document. I can't believe that it is not possible to do this, I mean that function is available by default, I just want to change it programmatically...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DocumentViewer 没有公开任何属性来更改 ViewMode。但如果您想以编程方式更改 ViewMode,则可以执行 DocumentViewer 公开的命令,如下所示 -
您可以将这些命令绑定到自定义按钮,或者以编程方式更改 ViewMode。假设您有一个名为
documentViewer
的DocumentViewer
,您可以像这样在此实例上调用这些方法 -DocuementViewer didn't exposed any property to change the ViewMode. But in case you want to change the ViewMode programmatically, you can execute the commands exposed by DocumentViewer which are as -
You can bind these commands to your custom button or programmatically you can change the ViewMode. Suppose you have a
DocuementViewer
nameddocumentViewer
, you can call these methods on this instance like this -