Set the state (the expanded property) of the expander.
This will cause the expander to open or close.
A Expander
the state of the expander to set