Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Collectionview KeepScrollOffset behaviour for bottom of list

I am using Xamarin.Forms v4.8.0.1534 and I have a list of items being displayed by a CollectionView. I have new items coming in at random intervals and the user may have scrolled the list to look at any historical item. The list needs to operate in two modes:

  • Monitoring: Where new items need to show immediately when added.
  • Checking: Where the user will be looking at historical items in the list.

If the list is showing the last item added when a new item is added (Monitoring mode), then the list should scroll to show the new item in full. if the user has scrolled the list to look at historical items then the list should not move when new items are added.

It is an option to add new items to the top of the list or the bottom.

If the option is set to add items to the top of the list and the ItemsUpdatingScrollMode = KeepScrollOffset then everything works as required.

However, there does not seem to be an equivalent setting for adding items at the bottom of the list.

I have tried different settings for ItemsUpdatingScrollMode, but nothing works as required, and I have also looked for ways to check if the last item added is visible in the CollectionView before adding the new one. The idea then would be to use ScrollTo if relevant, but I cannot find any way to check CollectionView item visibility.

I'm not sure If I am missing something obvious but any help would be appreciated especially around ways to check CollectionView item visibility.

Best Answer

Answers

  • bgraham1962bgraham1962 Member

    Thanks for the reply @LandLu, Ideally I would like a KeepScrollBottomOffset option but in the absence of that I will have to look into the custom renderer direction.

    Firstly, I need to go back to the business unit and see if the functionality is worth the extra effort or if they would be happy to just have the items appear at the top.

    Thanks again

Sign In or Register to comment.