Krishna
Krishna

Reputation: 37

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?

Upvotes: 3

Views: 2830

Answers (1)

SushiHangover
SushiHangover

Reputation: 74134

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.

Upvotes: 2

Related Questions