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

Reloading the ItemsSource does not reposition the grid items

Changing the contents of ItemsSource does not scroll the datagrid to the top left.  If you have been scrolling the datagrid it will stay where it was and is beyond confusing for a user.

Is there a way to do this until it is fixed?

4 Replies

KK Karthikraja Kalaimani Syncfusion Team October 17, 2022 05:15 AM

Hi LIoyd, 

The scroll position does not start from 0 when change the ItemSource because it is default behavior of DataGrid. However, you can reposition the ScrollView to 0 by programmatic scrolling after the ItemSource is changed. Please, refer to the below code snippets to achieve your requirement and we have also attached the working sample for your reference.

Code snippets : 

            (this.dataGrid.Children[0] as ScrollView).ScrollToAsync(0, 0, false);

Karthik Raja

Attachment: SfDataGridDemo_b7d2ac0c.zip

LS Lloyd Sheen October 17, 2022 01:10 PM

It is not the behaviour of the Xamarin DataGrid , or basically any other datagrid I have seen.  This behaviour is simply terrible.

What you suggest takes MVVM and throws it out the window.  The code you shows is dependent on code which would have to be in every View that uses a DataGrid.

This is a must have feature of a datagrid.

KK Karthikraja Kalaimani Syncfusion Team October 18, 2022 09:13 AM

Hi Lloyd, 

Currently, we are validating the behaviour with Xamarin forms DataGrid. We will validate and update the further details on or before 20th Oct 2022. We appreciate your patience until then.

Karthik Raja

KK Karthikraja Kalaimani Syncfusion Team October 20, 2022 10:58 PM

Hi Lloyd,

We have planned to change the behaviour of scroll position when ItemSource is changed by exposing public API which will decide to maintain or reset the scroll position when ItemSource is changed. We have logged feature request for the same and we will implement the feature in our upcoming 2022 Volume 4 release which is scheduled on mid of December 2022. We appreciate your patience until then.

You can track the status of this report through the following feedback link, https://www.syncfusion.com/feedback/38504/provide-support-to-reset-or-maintain-the-scroll-position-when-itemsource-is


Karthik Raja

Live Chat Icon For mobile
Up arrow icon