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

Scroll to last item or specific item

Thread ID:

Created:

Updated:

Platform:

Replies:

128696 Feb 6,2017 12:07 PM Feb 26,2017 01:44 PM Xamarin.Forms 6
loading
Tags: SfDataGrid
Emil
Asked On February 6, 2017 12:07 PM

is it possible to scroll to last item in sfdatagrid? for example, i have list of items and I add a new item with a button click, how can I scroll to this item which is last one? Is there something like ScrollTo function Xamarin Forms listview has?

Divakar Subramaniam [Syncfusion]
Replied On February 6, 2017 11:09 PM

Hi Emil, 
 
 
Thanks for contacting Syncfusion Support. 
 
 
In SfDataGrid, it is possible to scroll to specific index using SfDataGrid.ScrollToRowColumnIndex() method by passing RowIndex and ColumnIndex as parameters. 
 
 
Please refer the below UG link to know more about programmatic scrolling. 
 
 
 
Regards, 
Divakar. 


Dan Meier
Replied On February 22, 2017 11:52 PM

What is the actual scrolling behavior?  When I use ScrollToRowIndex(RowIndex), I'd expect the grid to scroll so that the index row is at the top of the grid.  Similarly, with ScrollToColumnIndex(ColIndex), I'd expect the grid to scroll so that the index column is at the left of the grid.  However, neither of these behaviors happens consistently. The index row or column always seems to be in view, but not where I expect it.  It seems the scrolling behavior is non-deterministic.  What's really happening?

Emil
Replied On February 25, 2017 10:34 PM

Hi Dan,

these functions only work if SfDataGrid is already created in another words if Items are already bound. Therefore you can create it in the constructor and if you want to scroll to specific column/row, you can use  OnAppearing event. I hope that it helps you. 

Cheers,

Emil

Emil
Replied On February 25, 2017 10:36 PM

Hi Divakar,

I am mostly using mvvm and i would like to know if somehow I can achieve this in my viewmodel. I already achieved in xaml.cs as I wrote to my response to Dan. please let me know

thanks,

Emil 

Ashok N [Syncfusion]
Replied On February 26, 2017 07:50 AM

Hi Dan, 
 
We have checked your query and SfDataGrid to scroll based on the given RowIndex and View size. The given RowIndex to place the top of the view when the remaining records count more than the view size. Otherwise the given RowIndex comes to the View and that RowIndex was placed based on the View size because SfDataGrid always fit the View size. This is the same for ScrollToColumnIndex also.  
 
Please let us know if you require further assistance on this.  
 
Regards, 
Ashok 


Ashok N [Syncfusion]
Replied On February 26, 2017 01:44 PM

Hi Emil, 
 
You can use the ScrollToRowColumnInde method in your ViewModel class by using Button click in MVVM by adding command and command parameter to the button. Please refer the below KB link for Button.Command binding  
 
 
Regards, 
Ashok 


CONFIRMATION

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.

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.

;