WPF ListView still reserving space when collapsed
-
19-09-2019 - |
Question
I have a WPF ListView within a ScrollViewer.
I need to collapse the ListView and I am trying withthis code (pretty striaghtoforward):
this.myListView.Visibility = Visibility.Collapsed;
Problem is the ListView seems to be reserving the space even when collapsed - it disappears but the ScrollViewer doesn't accordingly resize.
Anything I am missing?
Any Help appreciated
Solution 2
Thanks to everyone for their answers - I found out that a globally applied style was causing the problem! Solved now.
OTHER TIPS
Possible reason could be that ScrollViewer by default shows its vertical ScrollBar. Try to set ScrollViewer.VerticalScrollBarVisibility to auto. You can write something like this:
<ListBox ScrollViewer.VerticalScrollBarVisibility="Auto" />
I hope it helps.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow