1

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>
Community
  • 1
  • 1
JoshuadV
  • 194
  • 8
  • Sounds like layout issues. Add `Background` (with different colors) to all relevant elements and see arrangement for yourself. Example as it is not sufficient to reproduce the problem. I have feeling you are setting `Height` explicitly somewhere. – Sinatr Jan 31 '17 at 14:12
  • Thanks for the fast answer. I dont have Height setted anywhere, i have a Window with a fixed height, and if the content of the scrollviewer is getting to big, the scrollbar appears. – JoshuadV Jan 31 '17 at 14:27

0 Answers0