How to detect listview is scrolling up in Xamarin Forms IOS

Harrison_NguyenHarrison_Nguyen Member ✭✭
edited July 3 in Xamarin.Forms

I have this code to detect but only fire when scroll down for both method ItemAppearing and ItemDisappearing. Anyone please help

public MatchDetailListView() : base(ListViewCachingStrategy.RecycleElement)
    {
        ItemAppearing += MatchDetailListView_ItemAppearing;
        ItemDisappearing += MatchDetailListView_ItemDisappearing;
    }

    private void MatchDetailListView_ItemDisappearing(object sender, ItemVisibilityEventArgs e)
    {
    }

    private void MatchDetailListView_ItemAppearing(object sender, ItemVisibilityEventArgs e)
    {
        if (e.ItemIndex == 0)
        {
            MessagingCenter.Send(nameof(MatchDetailListView), "ScrollDown");
        }
    }
Tagged:

Answers

  • FaizalSaidaliFaizalSaidali USMember ✭✭✭

    Hi @Harrison_Nguyen, The UITableView provide the Scrolled event. I think you can access it by using ListViewRenderer. (I am not tried this). Otherwise you can get the delegate of UITableView as well.

  • Harrison_NguyenHarrison_Nguyen Member ✭✭

    @FaizalSaidali said:
    Hi @Harrison_Nguyen, The UITableView provide the Scrolled event. I think you can access it by using ListViewRenderer. (I am not tried this). Otherwise you can get the delegate of UITableView as well.

    I try to modify the Scrolled event but xamarin does not allow me to do that, it throws exception

  • ColeXColeX Member, Xamarin Team Xamurai

    I test with the solution :https://stackoverflow.com/a/44017943/8187800 , it works fine .

Sign In or Register to comment.