How to persist WPF expander control state ?

Mar 26 2013 1:46 AM

Hi

I  am using WPF Expander controls. There are 2 expanders in my screen. By default, when my screen is loaded, first expander is expanded and second one is always  collapsed, as per requirement.
I am expanding second expander on doubleclick event of grid row in first expander. My Second expander is containing some combo boxes. Upon selection of first combo box,  second combo is getting populated.I am using Notifypropertychanged event for this.
Problem :-
When my second combo box is getting populated,my second expander is getting collapsed and first one expanded.
I want to keep second expander expanded only, as its container of these combo boxes.
I want to persist expander properties as it is, dont want to reset it when any control action happens.
Seems like SelectionChanged event of tab control is getting called again and its reseting the expander to default
My code in tabcontrol selctionchanged event :-
if (RescanTab.IsSelected)
            {
                firstExpander.IsExpanded = true;
                secondExpander.IsExpanded = false;
            }

Could you please suggest, how to stop tab SelectionChanged event getting called when any of control within expander is notified ?

Regards
Sarang