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

How to: Remove Items from the Context Menu

  • 2 minutes to read

This example shows how to remove items from the PivoGridControl context menu.In this sample, the 'Show Prefilter', 'Show Field List' and 'Refresh Data' items are removed from the field headers' context menu. For this purpose, three RemoveBarItemAndLinkAction objects are added to the control's HeaderMenuCustomizations collection. Their ItemName properties are set to DefaultMenuItemNames.ShowPrefilter, DefaultMenuItemNames.ShowFieldList and DefaultMenuItemNames.RefreshData, respectively.

Imports Microsoft.VisualBasic
Imports System.Windows
Imports DXPivotGrid_HidingContextMenuItems.DataSet1TableAdapters

Namespace DXPivotGrid_HidingContextMenuItems
    Partial Public Class MainWindow
        Inherits Window
        Private salesPersonDataTable As New DataSet1.SalesPersonDataTable()
        Private salesPersonDataAdapter As New SalesPersonTableAdapter()
        Public Sub New()
            InitializeComponent()
            pivotGridControl1.DataSource = salesPersonDataTable
        End Sub
        Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
            salesPersonDataAdapter.Fill(salesPersonDataTable)
            pivotGridControl1.CollapseAllColumns()
        End Sub
    End Class
End Namespace