DocumentViewer toolbar and context menu

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

+6
controls wpf customization
source share
3 answers

You can prevent the default context menu from appearing when 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 for the DocumentView to not include the toolbar? I have never done much with styles, but I probably started looking for this.

+1
source share

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

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

+9
source share

You can simply set the ContextMenu property to null:

 <DocumentViewer ContextMenu="{x:Null}"/> 
+3
source share

All Articles