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. Image for the cookie policy date

ScrollRows_Changed event on sflistview?

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)
 

3 Replies

DB Dinesh Babu Yadav Syncfusion Team July 10, 2017 08:51 AM UTC

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 



EM Emil July 10, 2017 03:13 PM UTC

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;

        }



DB Dinesh Babu Yadav Syncfusion Team July 12, 2017 09:29 AM UTC

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   
 


Loader.
Up arrow icon