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?
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); |
Regards,
Karthik Raja
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.
Karthik Raja
We are glad to announce that our Essential Studio 2022 Volume 4 Main Release V20.4.0.38 is rolled out with "Provide support to reset or maintain the Scroll position based on the CanMaintainScrollPosition property like in Xamarin Forms DataGrid" feature and it is available for download under the following link.
You can set the CanMaintainScrollPosition property value as false to reset the scroll position whenever the ItemsSource is changed. For more details, please refer to the below code snippets.
Code snippets:
<syncfusion:SfDataGrid x:Name="data" ItemsSource="{Binding OrderInfoCollection}" CanMaintainScrollPosition="False"> |
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance