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.

How to change the Enter key behavior in SfDataGrid?

By default, in the SfDataGrid on pressing the Enter key, the currentcell is moved to the next row when NavigationMode is Cell. You can change this behavior like Tab key navigation that moves the currentcell to next cell of the same row by overriding the GridSelectionController.

The following code example shows you how to override the GridSelectionController.

C#

To customize the Enter key behavior, you need to override the ProcessKeyDown method in GridSelectionController. In this method, you can change the Enter key behavior like Tab key by changing the Enter KeyEventArgs to Tab KeyEventArgs and also you can assign the state of Tab key event handling args to Enter key event handling args.

The following code example illustrates how to change the Enter KeyEventArgs into Tab KeyEventArgs in ProcessKeyDown method.

C#

The following code example shows you how to set the instance of above GridSelectionControllerExt that is derived from GridSelectionController to SfDataGrid.SelectionController property.

C#

You can refer to the following sample to change the Enter key behavior.

Sample Link: CustomizeEnterKeyBehavior_WPF

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
3815 02/09/2015 06/09/2015 WPF SfDataGrid 4.5 12.3.0.36
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.