Current filter:
                                You should refresh the page.
                                Support Center
                                  • Hello! I am trying to add a 3rd level of items in an accordion control. I'm adding Groups and Items with no problem. I want to be able to add items under the items.  What would be the best way to do this.

                                    Thanks in advance.

                                1 Solution

                                Creation Date Rating Importance Sort by


                                Our AccordionControl provides the capability to create an unlimited number of hierarchy levels (ElementsAccordionControlElement.Elements). The main idea is to add a new group to an existing group. For example, you can do this at design time. I have attached a video to demonstrate this approach. Please try it and let me know your results.
                                I look forward to your reply.

                                • gary beasley 2 01.12.2017
                                  Thanks Alexey!  I know how to do this at design time. I've looked at the initialize code after doing so and I am confused as to why each AccordionControlElement() has to be "new"ed up twice when I do this at design time. I am using an accordion view on a user control and loading the various elements programmatically. Below is code I'm using in the UC Load event:
                                  private void NavigationBar_Load(object sender, EventArgs e) { // Add Activities Group AccordionControlElement groupActivities = new AccordionControlElement(); groupActivities.Style = ElementStyle.Group; groupActivities.Name = "GROUP_ACTIVITIES"; groupActivities.Text = "Activities"; // Add Reports Group AccordionControlElement groupReporting = new AccordionControlElement(); groupReporting.Style = ElementStyle.Group; groupReporting.Name = "GROUP_REPORTING"; groupReporting.Text = "Reports"; // Add Analytics Group AccordionControlElement groupAnalytics = new AccordionControlElement(); groupAnalytics.Style = ElementStyle.Group; groupAnalytics.Name = "GROUP_ANALYTICS"; groupAnalytics.Text = "Analytics"; // Add System Admin Group AccordionControlElement groupSysAdmin = new AccordionControlElement(); groupSysAdmin.Style = ElementStyle.Group; groupSysAdmin.Name = "GROUP_ADMIN"; groupSysAdmin.Text = "System Administration"; accordionControl1.Elements.Add(groupActivities); accordionControl1.Elements.Add(groupReporting); accordionControl1.Elements.Add(groupAnalytics); accordionControl1.Elements.Add(groupSysAdmin); AddNewItem(groupActivities, "Court Management", "COURTMAN"); AddNewItem(groupActivities, "Case Management", "CASEMAN"); AddNewItem(groupActivities, "E-Ticket Management", "ETICKETMAN"); AddNewItem(groupActivities, "Probation Management", "PROBMAN"); AddNewItem(groupReporting, "Report 1", "REP1"); AddNewItem(groupReporting, "Report 2", "REP2"); AddNewItem(groupReporting, "Report 3", "REP3"); AddNewItem(groupReporting, "Report 4", "REP4"); AddNewItem(groupAnalytics, "Crime Mapping", "CRIMEMAP"); AddNewItem(groupAnalytics, "Patrol Locations", "PATROLLOC"); AddNewItem(groupSysAdmin, "Violation Codes", "VIOLATIONCODES"); AddNewItem(groupSysAdmin, "Officers", "OFFICERS"); AddNewItem(groupSysAdmin, "System Codes", "SYSCODES"); } public void AddNewItem(AccordionControlElement GroupName, string ElementText, string ElementName) { AccordionControlElement NewElement = new AccordionControlElement() { Style = ElementStyle.Item, Text = ElementText, Name = ElementName }; GroupName.Elements.Add(NewElement); }
                                  What I would like to do is add items UNDER such items above as Court Management->Court Docket. As you may have deemed from this question, my C# skills are somewhat limited but I will try to adjust my code above to use the AddRange method instead, as that looks like the only way to add a sub group to a group.


                                • Alexey Z (DevExpress Support) 01.13.2017


                                  Thank you for providing us with the code snippet.
                                  As far as I understand, you wish to add a new item to the Court Management element. I.e. to create the 3rd hierarchy level. If so, use the AccordionControlElement.Style property to specify whether an element is considered a group or an item. Once you set the mentioned property to Group, you will be able to add items to this element. See the AccordionControlElement topic for more information about the difference between groups and items.
                                  I have created and attached a sample illustrating this approach. Please try it and let me know your results.
                                  I look forward to your reply.

                                • gary beasley 2 01.13.2017
                                  Perfect. Thanks for the example which works great. Thanks for laying this out "style" wise to match the way I was coding this.
                                  You guys are great!
                                • Alexey Z (DevExpress Support) 01.15.2017

                                  Thank you for informing us that the issue has been resolved. Feel free to contact us if you have additional questions.

                                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