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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid - AutoScroll and AutoEdit

Thread ID:





126283 Oct 5,2016 03:02 PM UTC Oct 10,2016 12:13 PM UTC WPF 3
Tags: SfDataGrid
Kurt Zimmermann
Asked On October 5, 2016 03:02 PM UTC


I am trying to do the following:
  • I have a SfDataGrid bound to a ObservableCollection<>
  • When the user clicks a button outside of the SfDataGrid I append a new item at the end of the Collection
  • The SfDataGrid should scroll automaticaly to the last row (representing the added item)
  • The SfDataGrid should start EditMode for this row

I have got the Scrolling to work by using the DataContextChanged event and the CollectionChanged event - but this is a very complex and ugly Code for such a simple Problem.

Do you have a nice solution for this?

Thanks Kurt

Sowndaiyan Paulpandi [Syncfusion]
Replied On October 6, 2016 12:51 PM UTC

Hi Kurt,

Thanks for contacting Syncfusion Support.

In SfDataGrid, you can achieve your requirement “AutoScroll and AutoEdit while adding new item in collection’ by using the ScrollToEnd method and BeginEdit method like the below code example,

private void Button_Click(object sender, RoutedEventArgs e) 
            (this.DataContext as ViewModel).OrdersDetails.Add(new OrderInfo() { CustomerID = "100009", Freight = 100 }); 
            Dispatcher.Invoke(new Action(() => 
                var viewModel = this.dataGrid.DataContext as ViewModel; 
                //find the RowIndex for particular record 
                var RowIndex = this.dataGrid.ResolveToRowIndex(viewModel.OrdersDetails[viewModel.OrdersDetails.Count - 1]); 
                // CurrentCell is set if MappingName is EmployeeID 
                this.dataGrid.MoveCurrentCell(new RowColumnIndex(RowIndex, 0)); 

We have prepared a sample as per your requirement and you can download the sample from the below location,

Sample : http://www.syncfusion.com/downloads/support/forum/126283/ze/WPF-1761942878


Kurt Zimmermann
Replied On October 7, 2016 12:57 PM UTC


thank's very much. I implemented it the way you suggest and it works perfect. The only differnece, I put your code in the CollectionChanged event of the Collection:

model.Medications.CollectionChanged += (s, e1) =>


if (e1.Action == NotifyCollectionChangedAction.Add)






Farjana Parveen Ayubb [Syncfusion]
Replied On October 10, 2016 12:13 PM UTC

Hi Kurt, 
Thank you for your response. 
Please let us know if you require further assistance from us. 
Farjana Parveen A 


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

or the page will be automatically redirected to 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