Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • How to collapse and expand the nav group when the group header area is clicked instead of just clicking the button?

                                    Andy

                                0

                                Hello Andy,

                                Thanks for your question. You can accomplish this task by handling the CustomDrawGroupCaption and MouseUp events as shown below:

                                [C#]
                                private void navBarControl1_CustomDrawGroupCaption(object sender, CustomDrawNavBarElementEventArgs e) { ((NavGroupInfoArgs)e.ObjectInfo).ButtonBounds = Rectangle.Empty; } private void navBarControl1_MouseUp(object sender, MouseEventArgs e) { NavBarHitInfo hInfo = ((NavBarControl)sender).CalcHitInfo(e.Location); if (hInfo.InGroupCaption) hInfo.Group.Expanded = !hInfo.Group.Expanded; }

                                Attached is a sample project, demonstrating how to implement this. Please review it, and let me know if you need any further assistance.

                                Thanks,
                                Uriah.

                                Q150531.ZIP
                                0

                                Thanks Uriah.
                                The header click works, but hiding the button doesn't look good. I would like the button click to work also just like the XP Windows Explorer. I tried to modified your sample but still couldn't make it work very well. Can you give a hint?

                                Andy

                                0

                                Hello Andy,

                                All you need to make it work is to add an additional condition into the MouseUp event handler and do nothing if a user clicks within the Group Button:

                                [C#]
                                private void navBarControl1_MouseUp(object sender, MouseEventArgs e) { NavBarHitInfo hInfo = ((NavBarControl)sender).CalcHitInfo(e.Location); if (hInfo.InGroupCaption && !hInfo.InGroupButton) hInfo.Group.Expanded = !hInfo.Group.Expanded; }

                                Thanks,
                                Uriah.

                                Q150531.ZIP
                                0

                                It works! Thank you very much for your help.

                                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