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
close icon

ScrollToRowIndex doesnt work in

ScrolltoRowIndex throws exception in latest version with the exception message below. 
this code below works just fine on version

 (listExercises.LayoutManager as Syncfusion.ListView.XForms.LinearLayout).ScrollToRowIndex(3);

{System.NullReferenceException: Object reference not set to an instance of an object.
  at Syncfusion.ListView.XForms.Android.ExtendedScrollViewRenderer.ExtendedScrollViewRenderer_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0003a] in <d6e57e21c8614f3e8b46ec1182767a41>:0 
  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:136 
  at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:380 
  at Syncfusion.ListView.XForms.ExtendedScrollView.set_ScrollPosition (System.Int32 value) [0x00011] in <a1a189e012b743fa8a431aa7607ea1d9>:0 
  at Syncfusion.ListView.XForms.LayoutBase.ScrollToRowIndex (System.Int32 rowIndex, System.Boolean disableAnimation) [0x000d7] in <a1a189e012b743fa8a431aa7607ea1d9>:0 

5 Replies

DB Dinesh Babu Yadav Syncfusion Team October 2, 2017 10:09 AM UTC

Hi Emil, 
Thank you for contacting Syncfusion support. 
We have checked the reported issue “Exception throws when ScrollToRowIndex is used” with the latest SfListView version(v at our sample. In the sample, we have scrolled to desired index in a button event at runtime using ScrollToRowIndex method but we did not face any issue as reported. We suspect that the issue occur might due to SfListView assemblies may not added or referenced properly in Android renderer project.  
So, we recommend you to please ensure that assemblies are referred in both PCL and Android renderer project and for more information please refer the following UG documentation link. 
For your reference, we have attached the ensured sample with latest SfListView version at our end and you can download it from the below link. 
Please let us know if you require further assistance. 
Dinesh Babu Yadav 

EM Emil October 2, 2017 11:22 AM UTC

I have just modified your sample and I could reproduce the problem. Changes I have done,

- Updated Android Support Libraries to latest

-I added selecteditem and moved scrolltorowindex into Property_changed event. Because in my scenario, I want to scroll to the selecteditem's index. Selecteditem is set in viewmodel and propertychanged should scroll to its index. In the sample attached you can change the selecteditem by selecting any item and you will see that it doesnt either scroll at all or it scrolls to wrong index than defined. Please try several times.

-If you downgrade to previous version with, you will see that it works fine.

Attachment: AutoFitSample_4ace19a1.7z

MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 3, 2017 12:29 PM UTC

Hi Emil,   
Sorry for the inconvenience caused.    
We are able to reproduce the reported issue “ScrollToRowIndex doesn’t work when defining same item index” at our end even after downgrading the SfListView version to As this is forum, we cannot provide patch so, a support incident has been created under your account for providing custom assemblies which includes the fix for the reported issue. Please log on to our support website to check for further updates.             
G.Muthu Kumaran. 

CN Christoph Nienaber October 10, 2017 09:52 PM UTC

I have the same issue. Please provide the fix.

MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 11, 2017 11:32 AM UTC

Hi Christoph,   
We have already checked the reported query “NullReferenceException throws when ScrollToRowIndex method is used” from our side. We found that the reported issue does not reproduce at our end and we have also attached the working sample link in previous update, but we have faced another issue which is “ScrollToRowIndex doesn’t work when passing same item index again after scrolling”, so we have fixed that issue.  And that fix will be included in our upcoming 2017 Volume 4 main release. So please provide us below details regarding your issue:  
  • Does the NullReferenceException throws when ScrollToRowIndex method is used in your sample? If yes, please share exception stack trace along with the replication procedure or video link which helps us to analyze the issue better.
  • Does the SfListView’s Orientation is set as ‘Horizontal’?
Please let us know if you require further assistance.   
G. Muthu Kumaran.   

Live Chat Icon For mobile
Up arrow icon