Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfViewerBarItemLinkCollectionExtensions.GetPdfViewerBarItemLink(BarItemLinkCollection, PdfViewerCommandId) Method

Retrieves a menu item by its command ID.

Namespace: DevExpress.XtraPdfViewer.Extensions

Assembly: DevExpress.XtraPdfViewer.v24.2.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