Krishna Krishna - 1 year ago 134
C# Question

How add a scroll bar in the scroll view of xamarin ios ?

I have a scroll view in xaml page. But I could not find a scroll bar associated with it. No property is available to show the scroll bar. Should I add a custom renderer class to display scroll bar?

Answer Source

UIScrollView do not have "Win32-style" always on scrollbars, there is a scroll indicator that can to shown while you are scrolling to show the user where they are within the scrollable view.

In a custom renderer (ScrollViewRenderer) you could set items like:

scrollView.ShowsHorizontalScrollIndicator = true;
scrollView.ShowsVerticalScrollIndicator = true;
scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);

But, again, the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

enter image description here

If you need them on screen all the time you would need to draw the scrollbars yourself.

Note: This is the same behavoir as the OS-X scroll view.