Current filter:
                                You should refresh the page.
                                Support Center
                                  • Is there a way to disable some of the default items that show on a column context menu? In particular, I would like to either disable or completely remove the "Runtime Column Customization" option.

                                1 Solution

                                Creation Date Rating Importance Sort by

                                Yes, you can disable or hide menu items. Please use the ShowGridMenu event for this. Also, please note that starting from the 10.2 version, the GridView's ShowGridMenu event is marked obsolete, so it needs to use the PopupMenuShowing event.
                                Here is sample code:

                                using DevExpress.Utils.Menu; using DevExpress.XtraGrid.Localization; using DevExpress.XtraGrid.Views.Grid; private DXMenuItem GetItemByStringId(DXPopupMenu menu, GridStringId id) { foreach ( DXMenuItem item in menu.Items ) if ( item.Caption == GridLocalizer.Active.GetLocalizedString(id) ) return item; return null; } private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e) { if ( e.MenuType == GridMenuType.Column ) { // Customize DXMenuItem miCustomize = GetItemByStringId(e.Menu, GridStringId.MenuColumnColumnCustomization); if ( miCustomize != null ) miCustomize.Visible = false; // Group By This Column DXMenuItem miGroup = GetItemByStringId(e.Menu, GridStringId.MenuColumnGroup); if ( miGroup != null ) miGroup.Enabled = false; } }
                                Imports DevExpress.Utils.Menu Imports DevExpress.XtraGrid.Localization Imports DevExpress.XtraGrid.Views.Grid Private Function GetItemByStringId(ByVal menu As DXPopupMenu, ByVal id As GridStringId) As DXMenuItem For Each item As DXMenuItem In menu.Items If item.Caption = GridLocalizer.Active.GetLocalizedString(id) Then Return item End If Next item Return Nothing End Function Private Sub gridView1_ShowGridMenu(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs) If e.MenuType = GridMenuType.Column Then ' Customize Dim miCustomize As DXMenuItem = GetItemByStringId(e.Menu, GridStringId.MenuColumnColumnCustomization) If miCustomize IsNot Nothing Then miCustomize.Visible = False End If ' Group By This Column Dim miGroup As DXMenuItem = GetItemByStringId(e.Menu, GridStringId.MenuColumnGroup) If miGroup IsNot Nothing Then miGroup.Enabled = False End If End If End Sub

                                See Also:
                                How to add a new item to the grid's popup menu
                                How to show a context menu for grid rows

                                Show all comments
                                • David Lemieux 02.06.2013

                                  This code is very weak. These handlers will fail if another handler changed the caption before.

                                • Hi Crono,

                                  Yes, you are right. Since a menu item caption is changed in your code, you can search for a changed caption in menu items. Another approach is to use the Tag property. A GridStringId value corresponding to the menu item is set to the item Tag.

                                  private DXMenuItem GetItemByStringId(DXPopupMenu menu, GridStringId id) { foreach (DXMenuItem item in menu.Items) { if ((GridStringId)item.Tag == id) { return item; } } return null; }
                                • Ser Solo 05.28.2014


                                  it is polible to do this for DevExpress.Xpf.Grid with TableView?

                                • Hello,
                                  To process your inquiry in the most efficient manner, I've moved it to a separate thread and forwarded to the WPF team:
                                  How to disable particular menu items in the default grid menus
                                  Please refer to it for further correspondence.
                                • Guido Geurts 02.25.2016
                                  in the newest version ShowGridMenu and PopupMenuShowing event do not exist anymore ?
                                  How to do this in the newest version ?

                                • Alexey Z (DevExpress Support) 02.25.2016


                                  To process your recent post more efficiently, I created a separate ticket on your behalf: T350155: XtraGridControl version 15.2 - Cannot find the ShowGridMenu and PopupMenuShowing events. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners