使用IsExpanded属性,将其设置为true以使内容可见:
IsExpanded
myExpander.IsExpanded = true;
将其设置为false以折叠扩展程序。
你可以直接设置 IsExpanded 属性,但我更喜欢使用 VisualStateManager 并使用 VisualStateManager.GoToState 进行此类 UI 更改。
VisualStateManager
VisualStateManager.GoToState