I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control.
Here are my Frustrations:
Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it)
Bad Borders I have a ListBox in my ScrollViewer. When I start the bottom of the list has no border and when I scroll down, the top border (line) of the list box disappears. I can kind of understand this, but attempts to set BorderThickness or BorderBrush for the ScrollViewer result in no change (I wanted to use the ScrollViewer's border to keep a constatant box around the list contents, like most list boxes out in cyber world).
Bad Handling of Short Lists When the items in the list don't reach the bottom the ScrollViewer keeps the scroll bar there and just dithers it out. Why not free up some space and remove it?
Some of these may seem petty (and they are). But users expect a certain look and feel fro开发者_Python百科m their apps and WPF is making it hard to get this out of the box.
If you know a way to fix any of these I would love a response. If there is a better way to deal with scrolling than using the ScrollViewer that would aslo be welcome.
Maybe you see some scroll bar from inside the list rather than the scroll bar from the ScrollViewer? Try setting
<ScrollViewer ... HorizontalScrollBarVisibility="Auto">
(default isHidden
, which means that no horizontal scroll bar is shown ever; also try "Visible" for the sake of debugging)Is putting a
<Border>
around the ScrollViewer an option?VerticalScrollBarVisibility
has a default value ofVisible
. If you want the scroll bar to disappear when it is not necessary, try<ScrollViewer ... VerticalScrollBarVisibility="Auto">
.
精彩评论