Skip to main content

PdfViewerBarItemLinkCollectionExtensions.GetPdfViewerBarItemLink(BarItemLinkCollection, PdfViewerCommandId) Method

Retrieves a menu item by its command ID.

Namespace: DevExpress.XtraPdfViewer.Extensions

Assembly: DevExpress.XtraPdfViewer.v24.1.dll

NuGet Package: DevExpress.Win.PdfViewer

Declaration

public static BarItemLink GetPdfViewerBarItemLink(
    this BarItemLinkCollection collection,
    PdfViewerCommandId commandId
)

Parameters

Name Type Description
collection BarItemLinkCollection

A collection of BarItemLink items.

commandId PdfViewerCommandId

An enumeration value that indicates the item’s command ID.

Returns

Type Description
BarItemLink

A target menu item.

Remarks

Use the GetPdfViewerBarItemLink method to access, remove, or disable any pop-up menu item. Handle the PdfViewer.PopupMenuShowing event to access the current pop-up menu. The ItemLinks property obtains the collection of menu items.

Example

The code sample below shows how to change a caption of a built-in menu item:

custom caption

using DevExpress.XtraPdfViewer;
using DevExpress.XtraPdfViewer.Commands;
using DevExpress.XtraPdfViewer.Extensions;
//...

void pdfViewer1_PopupMenuShowing(object sender, PdfPopupMenuShowingEventArgs e)
{
    // Retrieve a Hand Tool item
    // in the Page Content menu.
    if (e.PopupMenuKind == PdfPopupMenuKind.PageContent)
    {
        var handToolItem =
            e.ItemLinks.GetPdfViewerBarItemLink(PdfViewerCommandId.HandTool);

        // Change the item caption.
        handToolItem.Caption = "Custom Caption";
    }
}
See Also