/ XAMARIN

FastScroll and SectionIndexer in Xamarin.Forms ListView

Those of you who have played around with ListViews in Xamarin.Android are probably familiar with the FastScroll and SectionIndexer features.  They essentially make it really easy for users to navigate long lists by providing them with a little “handle” to quickly drag through lists, and with the SectionIndexer it also gives them a nice little popup showing where they are up to in the list.

Unfortunately, this feature isn’t available in Xamarin.Forms ListViews running on Android.

Well, it actually turns out is available through an Android Platform-Specific by the name of SetIsFastScrollEnabled.

And it’s dead simple to use, just with a single line of code:

<span class="csharp">listView.<span class="function">On</span><span class="operator"><</span><span class="type">Android</span><span class="operator">></span>().<span class="function">SetIsFastScrollEnabled</span>(<span class="constant">true</span>);</span>

Once you add that code, you will get the FastScroll thumb, but as a super-duper bonus if your ListView is grouped then you also get the SectionIndexer. So now your Xamarin.Forms lists can look like this:

Note: One thing to be aware of, in order for the FastScroll thumb to be visible, you will have to have a sufficiently large number of rows in your ListView (about 3 times as many rows as you have screen real estate for).

Further reading:

So I hope that helps, and Happy Coding!

kphillpotts

Kym Phillpotts

Geek, Parent, Human, Senior Content Developer at Microsoft. Co-curator of http://weeklyxamarin.com and twitch streaming live coding at http://twitch.tv/kymphillpotts.

Read More