0

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

Brandon
  • 16,382
  • 12
  • 55
  • 88
JohnIdol
  • 48,899
  • 61
  • 158
  • 242

2 Answers2

2

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.

levanovd
  • 4,095
  • 6
  • 37
  • 56
1

Thanks to everyone for their answers - I found out that a globally applied style was causing the problem! Solved now.

JohnIdol
  • 48,899
  • 61
  • 158
  • 242