A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello @Keerthana Krishna ,
Thanks for your question.
On Android, MAUI's CollectionView is backed by RecyclerView under the hood. The ItemsUpdatingScrollMode behavior is not consistently applied when the data source updates, so Android ignores or mishandles the auto-scroll trigger.
I suggest some following workarounds for Android:
- Programmatically scroll after update.
Whenever a new message is added, manually scroll to the last item:
private void ScrollToBottom()
{
var lastItem = Messages.LastOrDefault();
if (lastItem != null)
{
ChatCollectionView.ScrollTo(lastItem, position: ScrollToPosition.End, animate: true);
}
}
Call this after adding a new message to the list:
Messages.Add(newMessage);
ScrollToBottom();
- Use
ScrollTowith index.
int lastIndex = Messages.Count - 1;
if (lastIndex >= 0)
{
ChatCollectionView.ScrollTo(lastIndex, position: ScrollToPosition.End, animate: true);
}
- Please check if you are placing a
CollectionViewinside aScrollViewor aVerticalStackLayoutwithout bounded height. This breaks the scrolling because theCollectionViewgets unlimited height and never needs to scroll. - Combine both platforms with
ItemsUpdatingScrollMode+ manual scroll
<CollectionView x:Name="ChatCollectionView"
ItemsUpdatingScrollMode="KeepLastItemInView"
ItemsSource="{Binding Messages}">
And still call ScrollTo() in code for Android as a fallback.
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.