views:

181

answers:

2

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

+1  A: 

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
+1  A: 

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

JohnIdol