How to expand/collapse a WPF Expander in code? I need to do it in order to initialize a control in it.
Asked
Active
Viewed 1.6k times
2 Answers
22
Use the IsExpanded
property, set it to true for making the content visible:
myExpander.IsExpanded = true;
Set it to false to collapse the expander.

S2S2
- 8,322
- 5
- 37
- 65
0
You could just set IsExpanded
property, but I prefer to use VisualStateManager
and do such UI changes using VisualStateManager.GoToState
.

Anatolii Gabuza
- 6,184
- 2
- 36
- 54