is there scrollToBottom in the ScrollView?

mc 5,206 Reputation points
2024-02-17T14:34:33.07+00:00

If I scroll to bottom of the scrollview I can detect it and then add something to the scrollview(grid)

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,084 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,416 Reputation points Microsoft External Staff
    2024-02-19T09:49:56.9+00:00

    Hello,

    There is not a scrollToBottom method.

    If I scroll to bottom of the scrollview I can detect it

    You could calculate the offset of the scrollview, then detect the end. Please refer to the following code:

     <ScrollView  Scrolled="scrollView_Scrolled">
            <VerticalStackLayout>
    ...
    /ScrollView  >
    

    Scrolled event:

     private void scrollView_Scrolled(object sender, ScrolledEventArgs e)
      {
          var scrollview = sender as ScrollView;
          var space = scrollview.ContentSize.Height - scrollview.Height;
          if (space <= e.ScrollY)
          {
              Debug.WriteLine("bottom---------------");
          }
      }
    

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.