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}"/>