Get updated VerticalOffset of ScrollViewer after ChangeView()

Ram Kishore 1 Reputation point

While trying to scroll to the bottom of ListView using ListView's ScrollViewer like:

ScrollViewer.ChangeView(null, ScrollViewer.ScrollableHeight, null);

Due to virtualization, the bottom gets rendered on the scroll and bottom is pushed further more so there is some more left to scroll. I tried replacing ScrollableHeight with ExtentHeight like:

ScrollViewer.ChangeView(null, ScrollViewer.ExtentHeight , null);

Still it doesn't help.
So I tried to check if the ScrollViewer.VerticalOffset has reached the expected height, else again I am performing the ChangeView(). Here is the code:

while(ScrollViewer.VerticalOffset != ScrollViewer.ScrollableHeight)
   ScrollViewer.ChangeView(null, ScrollViewer.ScrollableHeight, null);

Here the problem is the ScrollViewer.VerticalOffset isn't updated by the change view. Tried UpdateLayout too but still doesn't work.

Is there any way to refresh the value of ScrollViewer.VerticalOffset after scroll?

Sample ListView code

<ListView x:Name="PicturesLV"
      ItemsSource="{x:Bind PicturesCollection, Mode=OneWay}"
          <DataTemplate x:DataType="model:PicturesBObj">
   <local:PicturesListViewItemControl PictureInstance="{x:Bind}"/>
   <TextBlock x:Name="BottomMostPartTb" Text="Bottom"/>

I used this PicturesLV.ScrollIntoView(PicturesLV.Footer) to scroll to the bottom. Since the pictures get rendered after scroll to bottom, the BottomMostPartTb gets pushed further below

Is there any way to hold the scrolled position irrespective of rendering and virutalization?

Universal Windows Platform (UWP)
{count} votes