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

sfDataGrid Scroll Trouble

I have problems with understanding syncfusion library for wpf. More specifically, it's about sfDataGrid control. This control is inside standard WPF ScrollView control. So, the problem is, whenever I hover sfDataGrid, it takes scroll events and the scroll itself is not working. So what's the problem? What's the best solution?

3 Replies

TV Thangapriya V Syncfusion Team March 4, 2016 06:25 AM UTC

Hi Maxim,
Thank you for using Syncfusion Products.
We have analyzed your query. SfDataGrid has its own ScrollViewer. So it is not recommended to load the SfDataGrid inside the ScrollViewer as it provides infinite size to its children which leads to lose of UI virtualization. While loading SfDataGrid inside ScrollViewer, the SfDataGrid’s ScollViewer gets disabled. However, you can overcome this by setting the height of SfDataGrid while loading inside the ScollViewer.

Code Example:


<ScrollViewer>

     <Syncfusion:SfDataGrid x:Name="dataGrid"

                            Height="600"

                            AutoGenerateColumns="True"

                            ItemsSource="{Binding Source}" />       

</ScrollViewer>


Regards,
Thangapriya


AC alvin chen replied to Thangapriya V September 21, 2022 02:04 AM UTC

there is something wrong in my application, when I reload the datasource , the sfdatagrid ’s scrollviewer always scroll to the first row. after edit or delete data from datasource, the scrollviewer scroll to the first row . when i use datagrid control ,everything works fine , i try to disabled  the sfdatagrid ’s scrollviewer , but it not work, there is any way to get this problem?



VS Vijayarasan Sivanandham Syncfusion Team September 21, 2022 07:31 PM UTC

Hi Alvin Chen,

Your requirement can be achieved by setting the true value for the CanMaintainScrollPosition property in SfDataGrid. Please refer to the below code snippet,

<syncfusion:SfDataGrid x:Name="sfDataGrid"

ItemsSource="{Binding Orders}"

CanMaintainScrollPosition="True" />


UG Link: https://help.syncfusion.com/wpf/datagrid/data-binding#maintain-scroll-position-when-changing-the-itemssource-for-sfdatagrid


Please let us know if you have any concerns about this.

Regards,

Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Live Chat Icon For mobile
Up arrow icon