I have a list of extenders that I want to control with their expanded state (IsExpanded) using the global toggle button, which should switch between the expanded / collapsed state.
The solution I got so far does this by linking the Expander Expander state to the IsChecked togglebutton state. This works until I manually switch the expanders. As soon as I do this, these specific expanders do not respect the binding (switch the "Fixed" button).
Any idea why? and is there a solution for this in XAML?
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<StackPanel>
<ToggleButton Name="ExpandAll">Toggle</ToggleButton>
<Expander IsExpanded="{Binding ElementName=ExpandAll,Path=IsChecked, Mode=OneWay}">
Hai
</Expander>
<Expander IsExpanded="{Binding ElementName=ExpandAll,Path=IsChecked, Mode=OneWay}">
Hello
</Expander>
<Expander IsExpanded="{Binding ElementName=ExpandAll,Path=IsChecked, Mode=OneWay}">
Weird
</Expander>
</StackPanel>
</Grid>
</Page>
source
share