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

Move to next Cell in a Column when Enter Button is pressed

Thread ID:





131406 Jul 7,2017 02:42 PM UTC Jul 10,2017 09:58 AM UTC WPF 1
Tags: GridDataControl
Rahul Makwana
Asked On July 7, 2017 02:42 PM UTC

I have a GridDataControl, in which I would like to know how to achieve following : 

There are three columns, only one of those is editable. I want user to be able to move to next cell in editable Column only when Enter is pressed.

How can I achieve this ?

Srinivasan Vasu [Syncfusion]
Replied On July 10, 2017 09:58 AM UTC

Hi Rahul, 
Thanks for contacting Syncfusion support. 
We have checked your query and you can achieve your requirement by using SfDataGrid.PreviewKeyDown event. In sample, the Name column only editable and while pressing the Enter key the focus move to next cell (next row)of editable column. 
Please refer the below code example 
         this.grid.PreviewKeyDown += Grid_PreviewKeyDown;        
        private void Grid_PreviewKeyDown(object sender, KeyEventArgs e) 
            //Get the row index of current cell             
            var rowindex = grid.Model.CurrencyManager.CurrentCell.RowIndex; 
            if (rowindex < (grid.Model.RowCount - 1)) 
                //Get the column index of current cell 
                var colindex = grid.Model.CurrencyManager.CurrentCell.ColumnIndex; 
                if (e.Key == Key.Enter) 
                    //Need to move the selection into next row of current column  
                    grid.Model.CurrencyManager.CurrentCell.MoveTo(rowindex + 1, colindex); 
                    e.Handled = true; 
Please download the sample from the below location. 


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