relapse
relapse

Reputation: 93

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.

Upvotes: 9

Views: 16895

Answers (2)

Anatolii Gabuza
Anatolii Gabuza

Reputation: 6260

You could just set IsExpanded property, but I prefer to use VisualStateManager and do such UI changes using VisualStateManager.GoToState.

Upvotes: 0

S2S2
S2S2

Reputation: 8512

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

myExpander.IsExpanded = true;

Set it to false to collapse the expander.

Upvotes: 23

Related Questions