Is there a way to force a scrollbar's visibility

Hello,

I have a ScrollView that contains a RepeaterView.
On both Android and iOS the scroll bar aren't initially visible. When I start scrolling they appear and later auto-hide. While I understand this is the expected behaviour is there a way to change this behaviour so the scroll bar are always visible and don't auto-hide?

Thanks.

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Use the search tool of the forum... I know I answered a virtually identical question less than 3 weeks ago where someone else wanted to force the scrollbar visibility.

  • ColeXColeX Member, Xamarin Team Xamurai
    edited November 2018

    You have to use Custom renderer to implement this.

    iOS

    Actually it is impossible to always show scroll bar even in native iOS, scroll indicator only appears when scrolling .
    As a temporary workaround , you can refer : https://stackoverflow.com/questions/45813371/xamarin-forms-listview-for-ios-always-show-scrollbar

    Android

    It is quite simple ,refer https://stackoverflow.com/a/7911203/8187800.

    solution with custom renderer

    class MyScrollviewRenderer : ScrollViewRenderer
    {
        public MyScrollviewRenderer(Context context) : base(context)
        {
        }
    
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);
    
            this.ScrollbarFadingEnabled = false;
        }
    }
    
Sign In or Register to comment.