2 Replies - 3686 Views - Last Post: 22 August 2014 - 10:23 AM Rate Topic: -----

#1 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

C# Windows Form Expander (or equivalent)

Posted 22 August 2014 - 08:28 AM

Hello all! I am working on a C# Windows form application, and I would like to have a group of controls on the panel not showing initally when the program starts. I would like to have some kind of button that can be pressed to expand the form window and show the extra controls, then be pressed again to hide the controls and shrink the window. The Expander class looks similar to what I want, but can't be used for forms apps as far as I can see. Is there another similar way to do this task in C# with other controls? Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: C# Windows Form Expander (or equivalent)

#2 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,772
  • Joined: 12-December 12

Re: C# Windows Form Expander (or equivalent)

Posted 22 August 2014 - 08:35 AM

You could write code to manipulate a SplitContainer, or there are a couple of expander plug-ins mentioned here at SO. (It doesn't have to be a SplitContainer but it probably requires a bit more effort to use a different control-type.)
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6507
  • View blog
  • Posts: 14,373
  • Joined: 02-June 10

Re: C# Windows Form Expander (or equivalent)

Posted 22 August 2014 - 10:23 AM

Does it have to be in 1980's WinForms? Is this targeting Windows 98 or XP? If I were making this for a modern OS in today's world (Win7 or later) I would do it in WPF.

In WPF you would bind the .Visiblity property of the control to a property in the code behind, through the BoolToVisiblityConverter. That way when it was set to true the item is visible, when set to false it is collapsed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1