Disable Context Menu in PDFViewWPF

40 views
Skip to first unread message

Tomas Hofmann

unread,
Jun 16, 2014, 6:01:44 PM6/16/14
to pdfne...@googlegroups.com
Q: I am building an application using the PDFViewWPF for PDF viewing and the PDFViewWPFTool project to edit PDFs. When the user right-clicks on the PDFViewWPF, a context menu pops up. I would like to disable this. How do I do that?

A: It is actually the PDFViewWPFTools that are responsible for the ContextMenu, not the PDFViewWPF.
Turning this off is as simple as calling ToolManager.SuppressContextMenu = true. 

This can also be done on a case by case basis, in case you have added your own content and would like to display your own context menu, by subscribing to the PDFViewWPF's PreviewRightMouseButtonUp and calling ToolManager.SuppressContextMenu = true.
Also, the Tool class (and any derivative) also has an AddContextMenuItems function. This can be used as follows: ToolManager.CurrentTool.AddContextMenuItems to add the tools option to your own context menu, if you want to. This way, you can add your own options and then add the options for the currently active tools below or above.

Reply all
Reply to author
Forward
0 new messages