CollectionView Challenge

Last week Xamarin posted a second challenge to allow users to provide feedback on the new CollectionView control that is going to be a part of the Xamarin.Forms 4.0 release. I decided to throw in my 2 pence worth 🙂

I decided to replicate a PoC Playstation Network trophy app that I wrote a while back as it is a good example of ListView usage.




What went well?

Overall it was very straightforward to replicate the same page using a CollectionView instead of a ListView. As you can see from the screenshots, the way that the layouts are rendered appears identical.

What didn’t go well?

The only problem that I ran into was that I initially tried to reuse the ViewCell that I created for the ListView with the CollectionView, reading through the documentation didn’t seem to mention that you can’t use a ViewCell as the root element for the CollectionView DataTemplate – I imagine you could get around this by using a ContentView as the root element in the layout though (I have not tried this though), this would then allow layouts to be written as reusable cells.

How is the performance?

Running on an x86_64 Android 9.0 emulator everything was a little sluggish and juddery when scrolling, but that could just be the emulator. When running on a device both the ListView and CollectionView were both very smooth when scrolling with a small occasional judder.

One thing that I did see with the ListView, but not with CollectionView, was that when scrolling down then scrolling back up again some controls within the ViewCell would disappear or be resized so their content was not displayed properly – this only seemed to affect labels and is not something I have seen when using Xamarin.Forms 3.x.

Missing or Desired Things:

I know some of these are either currently being worked on or are planned for a future release but, these are some of the features that CollectionView is currently missing:

  • Pull-to-Refresh
  • Header / HeaderTemplate
  • Footer / FooterTemplate
  • Grouping doesn’t seem to be possible
  • Item appearing/disappearing events
  • Scroll bar visibility
  • Separators
    • Visibility
    • Colour
    • Full width capability for iOS
  • Caching Strategy – It’s not clear what the behaviour for each platform is.
  • Ability to use a ViewCell as the item template.

Chris Howarth

Senior Xamarin Developer @ REPL Digital

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.