Expander Control - Keep An Expander Open

Apr 8, 2009 at 5:22 PM
Edited Apr 8, 2009 at 5:23 PM
Here's a Silverlight example of the project we're doing:

We have an expander control that will mimic the leftnav, and we need to have code to always have one item open. In the <Expander> items Collapsed event we have this


Expander)sender).IsExpanded = true;

While this does keep the one item open, the problem is the ToggleButton in the header still does it's on/off event. The ToggleButton in the Expander style does have the two way binding:





="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"

I guess we need a way for the Collapsed event to talk back to the ToggleButton in the Style to tell it to stay checked? Is there a way to find this ToggleButton in the <Expander.Header> element, which currently just has a TextBox with the text to go in the header?