Search code examples
wpfexpander

Expanding/collapsing a WPF Expander


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


Solution

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

    myExpander.IsExpanded = true;
    

    Set it to false to collapse the expander.