Expanding/collapsing a WPF Expander

relapse picture relapse · Jan 17, 2012 · Viewed 13.5k times · Source

How to expand/collapse a WPF Expander in code? I need to do it in order to initialize a control in it.

Answer

VSS picture VSS · Jan 17, 2012

Use the IsExpanded property, set it to true for making the content visible:

myExpander.IsExpanded = true;

Set it to false to collapse the expander.