HorizontalScrollBarVisibility = Visible: not always showing up RRS feed

  • Question

  • I have a Scrollviewer (in it a StackPanel containing of some elements). By default (HorizontalScrollBarVisibility = Auto), the scrollbar only appears if I move the pointer inside the scrollviewer. I want that it is always there. According to MSDN (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.scrollbarvisibility.aspx) I just have to set this property to Visible and it should appear "always". The problem is that it doesn't. I had expected that I don't need to move the pointer into the scrollviewer anymore - the scrollbar is there anyway. But it seems like the "Visible" behavior is the same as the "Auto" behavior.

    Am I missing anything or is this a bug?

    Friday, October 5, 2012 9:56 AM


  • The HorizontalScrollBarVisibility field doesn't affect the ScrollBar 's visibility based on the pointer state; it affects the ScrollBar's visibility based on the width of the items in the ScrollViewer. With Auto, the ScrollBar will show up only if the ScrollViewer's contents are wider than the ScrollViewer. If the contents are narrower and don't need to be scrolled then the ScrollBar won't display. With Visible the ScrollBar will display even if the contents are narrower than the ScrollViewer and so don't need to be scrolled.

    If you want to divorce the ScrollBar's visibility from the pointer state then you can override the ScrollViewer's template. Select a ScrollViewer in the designer and choose the Edit Template... menu. You can then update the ScrollViewer's VisualStateManager to show what you'd like in the NoIndicator state.


    • Marked as answer by peterGro Monday, October 8, 2012 6:32 AM
    Friday, October 5, 2012 6:21 PM