PdfViewer.PopupMenuShowing Event
Occurs after the popup menu of a PDF Viewer has been invoked.
Namespace: DevExpress.XtraPdfViewer
Assembly: DevExpress.XtraPdfViewer.v18.1.dll
Declaration
Event Data
The PopupMenuShowing event's data class is PdfPopupMenuShowingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
ItemLinks | Gets the collection of popup menu links displayed when the menu is being invoked. |
Menu | Obsolete. Provides access to a popup menu that is being invoked. |
PopupMenuKind | Gets the type of a particular popup menu shown for the PDF Viewer. |
Example
This example demonstrates how to add a custom bar button item to the popup menu.
To add a new item to a popup menu shown for the navigation pane of a PDF Viewer, handle the PdfViewer.PopupMenuShowing event and then use the PdfPopupMenuShowingEventArgs.ItemLinks property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-add-a-custom-bar-button-item-to-the-popup-menu-t328781
using System.Windows.Forms;
using DevExpress.XtraPdfViewer;
using DevExpress.XtraBars;
namespace CustomPopupMenu {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
pdfViewer1.LoadDocument("..\\..\\Demo.pdf");
}
void pdfViewer1_PopupMenuShowing(object sender, PdfPopupMenuShowingEventArgs e) {
// Create a bar button item.
BarButtonItem browseBarButton = new BarButtonItem();
browseBarButton.Caption = "Custom Item";
// Insert the bar buttom item into the PDF Viewer popup menu and start a new group.
e.ItemLinks.Add(browseBarButton, true);
// Handle the bar button click event.
browseBarButton.ItemClick += browseBarButton_ItemClick;
}
void browseBarButton_ItemClick(object sender, ItemClickEventArgs e) {
MessageBox.Show("ItemClick event fires");
}
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PopupMenuShowing event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.