DocumentViewer toolbar and context menu

狂风中的少年 提交于 2019-12-07 00:37:43

问题


How to hide the default toolbar and to disallow the default context menu of the DocumentViewer control?


回答1:


You can prevent the default context menu from appearing by handling the ContextMenuOpening event, and setting ContextMenuEventArgs.Handled to true.

As for the toolbar, I'm not sure - maybe you could somehow change the default style of the DocumentView to not include the toolbar? I haven't ever done much with styles, but that is probably where I'd start looking.




回答2:


You can hide (or change) the toolbar by creating a control template for DocumentViewer without the toolbar.

start with the sample template from https://msdn.microsoft.com/en-us/library/aa970452(v=vs.100) and add and remove things until you are happy with the results.




回答3:


You can just set the ContextMenu property to null like this:

<DocumentViewer ContextMenu="{x:Null}"/>


来源:https://stackoverflow.com/questions/201875/documentviewer-toolbar-and-context-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!