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.

ListView.ScrollTo not working in UWP

DerProgrammiererDerProgrammierer DEMember ✭✭✭
edited December 2016 in Xamarin.Forms

I'm trying to scroll down to the last item of a ListView by calling a System.Action "refreshScrollDown()" in my ViewModel, which then gets handled in the code-behind of my xaml:

refreshScrollDown ();


ViewModel.refreshScrollDown = () => {
    if (ViewModel.Messages.Count > 0) {
        Device.BeginInvokeOnMainThread (() => {

            ListViewMessages.ScrollTo (ViewModel.Messages [ViewModel.Messages.Count - 1], ScrollToPosition.End, true);

This works on iOS and Android, but not on UWP. Rarely it will scroll to the bottom, but most of the times it won't. There is no exception.

Does anyone have an idea how I could work on it? Suggestions are appreciated. Thank you!

EDIT: If I use ScrollTo just at the point where I added an item to the ListView, it will scroll. What's not working is uploading the message to the server, then refreshing my ListView and THEN trying to scroll in UWP.


  • huangjinshehuangjinshe USMember ✭✭✭

    please make a sample project and report it to :

  • RockerRocker USMember

    I ran into a similar problem. I had my ListView bound to an ObservableCollection. If a string was duplicated, it wouldn't go to the last one even if ScrollToPosition.End was used...

    I bound my ListView to ObservableCollection where StringCounter looks like:

    public class StringCounter
    public string Message { get; set; }
    public int Counter { get; set; }

    Format the ListView output to show just the string.
    ItemTemplate = new DataTemplate(() =>
    var grid = new Grid();
    var labelMessage = new Label();
    labelMessage.SetBinding(Label.TextProperty, "Message");
    grid.Children.Add(labelMessage, 0, 0);
    return new ViewCell { View = grid };

Sign In or Register to comment.