Click here to Skip to main content
16,001,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to develop Accordion control (as in Asp.net Ajax) in VB.Net. Can someone help?
Posted
Updated 17-Mar-10 20:40pm
v2

There is nothing in the basic framework that will do this. The closest
thing for WinForms is probably the ExplorerBar functionality seen in the left menu in "My Computer". This is available commercially from third party companies like Infragistics/DevExpress/etc.

There are also free collapsible GroupBox implementations around that may
work, or you can create your own by drawing and handling the non client area events in a UserControl.
Try this:
Themed Windows XP style Explorer Bar[^]
 
Share this answer
 
Hi there,

There's no control that can be use to create an accordion in winforms but you just need to have a little imagination on how it accordion process.

I simple made a simple example that may look like 98% accordion in winforms.

here are the controls that I've used, but you can use other controls just follow the logic

Tools
Panel
Radio Buttons 2 or 3 will do
2 Timers
1 button for showing and 1 for hiding

Logic for an updown accordion
1. Put the radio buttons inside the panel.
2. Get the size that will fit the radio button inside the panel and remember or note it.
3. Set the height size of panel to zero and set visible = false
4. now code button for showing then enable the timer1 that will make the animation to show

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Panel1.Height >= 60 Then ' 60 was the height that will fit my radio buttons
Panel1.Height += 3 ' this will do the animation
End If
End Sub

5. now code button for hiding then disable timer1 and enable 2 that will make the hiding animation

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
If Panel1.Height > 0 Then
Panel1.Height -= 3
Else
Panel1.Height = 0
Panel1.Visible = False
Timer2.Enabled = False
End If
End Sub


And thats the logic on how to do it, you can apply to whatever you desires.

Hope this helps
Elieser Legaspi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900