Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I am using http://www.devexpress.com/kb=A47 to disable certain popup menu items, but it is not working to remove the "Show Group By Box" option. What am I doing wrong?

                                        Private Sub gvProduct_PopupMenuShowing(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs) Handles gvProduct.PopupMenuShowing
                                            Try
                                                If e.MenuType = DevExpress.XtraGrid.Views.Grid.GridMenuType.Column Then
                                                    For i As Integer = e.Menu.Items.Count - 1 To 0 Step -1
                                                        If (e.Menu.Items(i).Caption = GridLocalizer.Active.GetLocalizedString(GridStringId.MenuColumnGroupBox)) OrElse (e.Menu.Items(i).Caption = GridLocalizer.Active.GetLocalizedString(GridStringId.MenuColumnGroup)) Then
                                                            e.Menu.Items.Remove(e.Menu.Items(i))
                                                        End If
                                                    Next i
                                                End If
                                            Catch ex As Exception
                                                msgBox("error")
                                            End Try
                                        End Sub

                                0

                                Hi Rachael,

                                It looks like you are using the wrong GridStringId object. Try to use the GridStringId.MenuColumnGroupBox value.
                                Does this help?

                                Thanks
                                Dimitros

                                0

                                I am using GridStringId.MenuColumnGroupBox.
                                If you look at my If statement, I am trying to remove both MenuColumnGroupBox and MenuColumnGroup.

                                0

                                Hi Rachael,

                                I missed this line. I apologize for this. To accomplish this task, try to use the following code:

                                	
                                [VB.NET]
                                Private Sub gridView1_PopupMenuShowing(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs) Handles gridView1.PopupMenuShowing If e.MenuType = DevExpress.XtraGrid.Views.Grid.GridMenuType.Column Then RemoveShowGroupByBoxItem(e.Menu) End If End Sub Private Sub RemoveShowGroupByBoxItem(ByVal menu As DevExpress.XtraGrid.Menu.GridViewMenu) For i As Integer = menu.Items.Count - 1 To 0 Step -1 Dim item As DevExpress.Utils.Menu.DXMenuItem = menu.Items(i) If Object.Equals(item.Tag, GridStringId.MenuColumnGroupBox) OrElse Object.Equals(item.Tag, GridStringId.MenuColumnGroup) Then menu.Items.Remove(item) End If Next i End Sub

                                Attached is a sample project, illustrating this approach. Please review it and let me know whether or not it meets your requirements.

                                Thanks
                                Dimitros

                                dxSample.zip

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com 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, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

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