Callapse groupBox programmatically

I have a groupBox which is collapsable=true and as default collapsed=false. I want to change programmatically if it is collapsed/expanded. It seems that doesn’t work.
So I added a listener for the ExpandedStateChangeEvent. Why is there an event after opening the site with collapse=true although my default setting is false?
Here some snippets of my code:

<groupBox id="events" caption="msg://events" spacing="true"
                      collapsable="true" collapsed="false" stylename="todo">
                <groupTable id="productsTable" height="AUTO" width="100%"
                            dataContainer="eventChangedDC" multiselect="true">

In the controller I tried to do something like this:


Do I anything wrong?
Thank you!!

Are you using ScreenSettingsFacet on the screen?
Perhaps it restores the saved state of the groupBox during the AfterShow screen event.