Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

ListView-Any way to MVVM bind to ScrollTo?

$
0
0

I'd like for my ListView to scroll to the last item added to the ObservableCollection<> that is its .ItemSource, when a new item is added.
I can't seem to find any way to do that. ScrollTo() is a method, not a property, so there is no way to bind that to a property in the ViewModel.
Is there a way to make the ListView auto-scroll to the SelectedItem; which can be set through binding? Its kinda silly for the ViewModel to set a new item as selected, but the ListView doesn't scroll to it/bring it into view. Something like this would be nice: EIther to binding to an item to bring into view or a bool to autoscroll to selected.

            <ListView x:Name="imagesListView"
                      ItemsSource="{Binding PendingScans}"
                      SelectedItem="{Binding SelectedPendingImagePath,
                                     Mode=TwoWay}"
                      ScrollToItem="{Binding SelectedPendingImagePath}"
                      ScrollToSelected = "True"
                      Grid.Row="1"
                      Grid.Column="1"></ListView>

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>