35
votes

Is it possible to force the horizontal (or vertical) scroll to NOT display even when needed?

The thing is that I need to display colors that are different depending of the item. That works fine but you can clearly see that the color does not reach both edge of the list view, which is kinda ugly. To make things worse, I have in my listview another listview that contains another list of item. Those item's background does not come even close to the edge of the listview.

2
The thing is that I need to display colors that are different depending of the item. That works fine but you can clearly see that the color does not reach both edge of the list view, which is kinda ugly. To make things worse, I have in my listview another listview that contains another list of item. Those item's background does not come even close to the edge of the listview. If there is a way to do this, I am all in.David Brunelle

2 Answers

97
votes

You can specify the visibility of the scrollbar for both vertical and horizontal scrolling to four options, using the ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility attached properties: Auto, Disabled, Hidden and Visible.

<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled">

Disabled will have it never show up and scrolling is not possible, Hidden will have it not show, but will allow users to scroll using text selection and arrow keys/mousewheel, etc.

10
votes

Directly on the scroll bar:

<ScrollViewer HorizontalScrollBarVisibility="Hidden" />

If you're doing it in a control that implements it in its ControlTemplate:

<StackPanel ScrollViewer.HorizontalScrollBarVisibility="Hidden" />