WPF Reflections

Dec 12 2007   3:14PM GMT

ListView – scrollbars gone?

Mark Shurmer Profile: MarkWPF

Have you ever lost the scrollbars in a ListView?

What I mean is, there lots of rows in the ListView, but it’s not displaying any scrollbar, even if you set the ScrollViewer.VerticalScrollBarVisibility property? An example of this is:

<ListView Name=”lvInstruments” ScrollViewer.VerticalScrollBarVisibility=”Auto” ScrollViewer.CanContentScroll=”True” >
    <rest of listview stuff…./><
<Canvas HorizontalAlignment=”Center” VerticalAlignment=”Center”>
<TextBlock Text=”The instrument may have been invalid or the search too ambiguous” Visibility=”Hidden” Name=”txtError” Style=”{DynamicResource TextBlock Error}” Canvas.Left=”5″ Canvas.Top=”20″ />

Here the canvas is used to locate a textblock over the listview, and though that could have been done other ways, it’s just an exampleWhat you will find with the above example is that there are no scrollbars!
To fix, just change the StackPanel to a WrapPanel, and bisto 🙂

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: