I had a real hard time finding the property but its there. maybe not documented.
for a layer leg.Layers.ItemByHandle(hndStates).Expanded = False
for a group leg.Groups.ItemByHandle(m_GroupHandle).Expanded = True
for all groups leg.Groups.ExpandAll() and leg.Groups.CollapseAll()
AGP
for a layer leg.Layers.ItemByHandle(hndStates).Expanded = False
for a group leg.Groups.ItemByHandle(m_GroupHandle).Expanded = True
for all groups leg.Groups.ExpandAll() and leg.Groups.CollapseAll()
AGP