16

anyone know a c# winforms accordion control?

preferrably open source or free.

  • Check this out. It is awesome http://www.codeproject.com/Articles/416521/Easy-WinForms-Accordion-Control This is a late answer but it is helpful to someone else – Moons Jan 09 '13 at 07:12

3 Answers3

16

Here is a basic example that uses CheckBox controls with Appearance set to Button for the headers. Download accordion.cs on sourceforge.

Demo code:

    Accordion acc = new Accordion();
    acc.CheckBoxMargin = new Padding(2);
    acc.ContentMargin = new Padding(15, 5, 15, 5);
    acc.ContentPadding = new Padding(1);
    acc.Insets = new Padding(5);
    acc.ControlBackColor = Color.White;
    acc.ContentBackColor = Color.CadetBlue;

    TableLayoutPanel tlp = new TableLayoutPanel { Dock = DockStyle.Fill, Padding = new Padding(5) };
    tlp.TabStop = true;
    tlp.Controls.Add(new Label { Text = "First Name", TextAlign = ContentAlignment.BottomLeft }, 0, 0);
    tlp.Controls.Add(new TextBox(), 1, 0);
    tlp.Controls.Add(new Label { Text = "Last Name", TextAlign = ContentAlignment.BottomLeft }, 0, 1);
    tlp.Controls.Add(new TextBox(), 1, 1);

    acc.Add(tlp,"Contact Info", "Enter the client's information.", 0, true);
    acc.Add(new TextBox { Dock = DockStyle.Fill, Multiline = true, BackColor = Color.White }, "Memo", "Additional Client Info", 1, true, contentBackColor:Color.Transparent);
    acc.Add(new Control(), "Other Info", "Miscellaneous information.");

enter image description here

Loathing
  • 5,109
  • 3
  • 24
  • 35
  • 2
    5 years late to party, but the code written for accordion is one of most poorly written code I've ever seen. it has put my 10 year old code to shame in terms of "How bad you can code" – Bhanu Chhabra Feb 25 '19 at 18:02
  • @BhanuChhabra Nobody is forcing you to use it. Go cry a river, or since you are so talented, make your own. – Loathing Apr 21 '23 at 12:26
  • @BhanuChhabra Someone takes the time to make a control that people are looking for, asking for nothing in return, and all you do is s- on it. Nothing in your comment adds any value. – Loathing Apr 21 '23 at 12:29
  • I apologize for what I have written. I have no recollection of why I wrote in such a way or what was going on in my mind while I wrote the comment. None of these excuses my behaviour. Apologies once again. – Bhanu Chhabra Apr 24 '23 at 18:49
0

XPTaskBar might meet your needs. I use the commercial (but reasonably-priced) Krypton Suite

Eric J.
  • 147,927
  • 63
  • 340
  • 553
-1

Synfusion has GroupBar , its basically Outlook like Left Side Bar Its pretty slick http://www.syncfusion.com/products/user-interface-edition/windows-forms/tools/features#navigation-package

Pavi
  • 15
  • 2