Xamarin.Forms & CollectionView's Equivelant of IsVerticalRailEnabled

Nathan Sokalski 4,126 Reputation points
2021-02-10T16:51:48.153+00:00

In UWP, many of the scrollable controls (such as ScrollView) had a property named IsVerticalRailEnabled, which displayed sort of a skinny scrollbar. I need something similar for CollectionView in Xamarin.Forms. I could, of course, use a Custom Renderer, but I was wondering if there are any built-in ways to do something similar, or a way to customize only the scrollbar (instead of the entire CollectionView). Any ideas? Thanks!

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 72,336 Reputation points Microsoft Vendor
    2021-02-11T06:10:25.13+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Without Custom Renderer, Xamarin forms provide VerticalScrollBarVisibility and HorizontalScrollBarVisibility to control the Scrollbar.

    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/collectionview/scrolling#scroll-bar-visibility.

    VerticalScrollBarVisibility is the same as ScrollViewer.VerticalScrollBarVisibilityProperty in UWP, not the IsVerticalRailEnabled, there are no other built-in ways to control Scrollbar, Xamarin.Forms need to support three platforms, some UWP features are not existed in iOS and Android. So built-in ways may be simple.

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nathan Sokalski 4,126 Reputation points
    2021-02-11T16:00:19.547+00:00

    So the only way to get a Rail instead of a regular Scrollbar is a Custom Renderer? I guess that isn't extremely surprising, but I wanted to make sure before trying to make a complete Custom Renderer for a complete CollectionView (I was hoping to only need to do anything fancy for the Scrollbar component), since I am relatively new to both Xamarin.Forms and Android, and have written very few Custom Renderers. I may end up making the Custom Renderer at some point, but I guess it's going on the back burner for now. Maybe if we're lucky MAUI will have a nice way to do it.

    0 comments No comments