Skip to main content

Hide Scrollbars for ListView with ScrollBarVisibility

·2 mins

This PR of mine just got merged into master on the Xamarin.Forms repository. With this change, you can disable showing the scrollbars with the ScrollBarVisibility enum for the ListView control. This was done before for the ScrollView, but not the ListView. This should be available in a Xamarin.Forms nightly build soon for iOS, Android, Mac OS, UWP and WPF. 

What Changed? #

I have introduced two simple properties on the ListView, these are HorizontalScrollBarVisibility and VerticalScrollBarVisibility. These are both of enum type ScrollBarVisibility, which was already introduced for the ScrollView I mentioned earlier. You can now simply set these on your ListView like this:

Or course, you can do the same thing from C# code. The ScrollBarVisibility enum has three options:

They are pretty self-explanatory. With Default, the behavior will remain the same as it is intended on that platform. None, will hide the scrollbar and Always, will make sure that they are always shown. It’s as simple as that!

Here you can see the before and after screenshot on iOS;

ListView with ScrollBarVisibility

ListView with ScrollBarVisibility

If you look closely, you will notice that in the right screenshot the scrollbar is not visible while the ListView is scrolling (trust me ;))

Other PRs and Contributing yourself #

There are some other posts I have written on PRs that got merged and did you ever think of contributing yourself? It is a great way of getting even more familiar with Xamarin.Forms, and since you have been using it for a long time, isn’t it great to be able to do something back?

To get started you can simply head over to the repository, pick a great issue and start working on it, it is really as simple as that! If you need any help, please let me know, I’ll be happy to get you started.