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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid getting highest visible row

Thread ID:





145282 Jun 15,2019 09:55 AM UTC Jun 17,2019 05:13 PM UTC WPF 1
Tags: SfDataGrid
Asked On June 15, 2019 09:55 AM UTC

I'm working on the project based on the Syncfusion and I have the following issue to solve.
We have the SfDataGrid with some data and it is easily scrolled (obviously).
I'd like to detect the index of the row which is currently displayed on the top of the DataGrid.
Which method should I use?

Best regards,

Shobika Palani [Syncfusion]
Replied On June 17, 2019 05:13 PM UTC

Hi Agata, 

Thank you for using Syncfusion Products. 

We have analyzed your query to get the first visible row index in view. Your requirement can be achieved by using the VisibleLineInfoCollection as like below code snippet 

private void Button_Click(object sender, RoutedEventArgs e) 
            var visibleLines = this.sfdatagrid.GetVisualContainer().ScrollRows.GetVisibleLines(); 
            var firstVisibleRow = visibleLines.FirstOrDefault(line => line.Region == ScrollAxisRegion.Body); 
            var firstVisibleRowIndex = firstVisibleRow.LineIndex; 

Please find sample for the same from the below link 

Sample Link: 

Please let us know, if you need any further assistance on this. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon