I have multiple expanders, where only one should be expanded at a time. I implemented this, using this answer. The problem appears when a ScrollViewer with a VerticalScrollBar (Visibility Auto) is added around these Expanders.
Problem Example:
- 3 Expanders (a,b,c)
- Expander a expanded, b & c collapsed
- When Expander b is clicked, a collapses and b is expanded, but the scrollbar is visible (but disabled), even though there would be enough space
When b is expanded, the scrollbar visibility updates (to visible, because when a & b would be expanded, there wouldn't be enough space), but when a is collapsed, it doesn't update to hidden again.
This is a shortened version of my xaml. The way the Expanded-Property is binded, is the same as in the linked answer.
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<DockPanel>
<Expander x:Name="a"/>
<Expander x:Name="b"/>
<Expander x:Name="c"/>
</DockPanel>
</Grid>
</ScrollViewer>