We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

ScrollRows_Changed event on sflistview?

Thread ID:

Created:

Updated:

Platform:

Replies:

131435 Jul 9,2017 07:02 PM Jul 12,2017 05:29 AM Xamarin.Forms 3
loading
Tags: SfListView
Emil
Asked On July 9, 2017 07:02 PM

I was using ScrollRows_Changed event on sfdatagrid but I want to use sflistview instead of sfdatagrid. is it there an equivalent event as below?  

 private void ScrollRows_Changed(object sender, Syncfusion.GridCommon.ScrollAxis.ScrollChangedEventArgs e)
 

Dinesh Babu Yadav [Syncfusion]
Replied On July 10, 2017 04:51 AM

Hi Emil, 
 
Thank you for contacting Syncfusion Support. 
 
The reported requirement “Accessing ScrollRows changed event in SfListView” can achieved by using reflection in sample level. You can get the VisualContainer from SfListView through reflection and similarly get the ScrollAxisBase from VisualContainer and hook the scrollaxisbase changed event as like below code snippet. 
 
Code Snippet[C#]: 
ScrollAxisBase scrollRows; 
VisualContainer visualContainer; 
   
public MainPage() 
{ 
  InitializeComponent(); 
   visualContainer = listView.GetType().GetRuntimeProperties().First(p => p.Name == "VisualContainer").GetValue(listView) as VisualContainer; 
   scrollRows = visualContainer.GetType().GetRuntimeProperties().First(p => p.Name == "ScrollRows").GetValue(visualContainer) as ScrollAxisBase; 
   scrollRows.Changed += ScrollRows_Changed; 
} 
 
private void ScrollRows_Changed(object sender, ScrollChangedEventArgs e) 
{ 
 
} 
 
 
For more information, please refer the following KB link, in which we have reflected the ScrollAxisBase’s Changed event. 
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 


Emil
Replied On July 10, 2017 11:13 AM

Hi Dinesh,

this works fine but I cant figure out how to determine if user is scrolling down or up. for example, on sfdatagrid I had solution as below. this was based on VerticalOffset of container because sfdatagrid VisualContainer exposes this attribute. I cant find same attribute on sfListview VisualContainer. I appreciate for your help


  private void ScrollRows_Changed(object sender, Syncfusion.GridCommon.ScrollAxis.ScrollChangedEventArgs e)

        {      

            // Will be called when the SfDataGrid is scrolled 

            if (previousOffset > 0)

            {

                if (previousOffset > container.VerticalOffset)

                {

              //  scrolling up

                }

                else if (previousOffset == container.VerticalOffset)

                {

                   // not scrolling

                }

                else

                {

                   //scrolling down

                }

            }

                    previousOffset = container.VerticalOffset;

        }


Dinesh Babu Yadav [Syncfusion]
Replied On July 12, 2017 05:29 AM

Hi Emil,   
   
In SfListView, we have ScrollOffset property in VisualContainer like VerticalOffset in SfDataGrid. You can access it by using reflection  like below code example.   
   
Code Example[C#]:   
private void ScrollRows_Changed(object sender, ScrollChangedEventArgs e)   
{   
  var scrolloffset = (double)visualContainer.GetType().GetRuntimeProperties().   
                     First(p => p.Name == "ScrollOffset").GetValue(visualContainer);   
}   
  
Regards,   
Dinesh Babu Yadav   
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;