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

How to do AddNewRow operations programmatically in the SfDataGrid?

Platform: WPF |
Control: SfDataGrid
Tags: addnewrow

In the SfDataGrid, AddNewRow allows you to add the new data row in the UI by entering new records. By default, the new row is added at the end, otherwise it is added based on the sorted data position when LiveUpdateMode is set as AllowDataShapping.

The following screenshot shows the default view of AddNewRow in the SfDataGrid.



Figure 1 : Default view AddNewRow

When adding a new row, you can commit the new row by pressing the Enter key and cancel committing the new row by pressing the ESC key twice.


You can perform these operations programmatically in run time also.

The following code example illustrates how to cancel the new row being committed by calling AddNewRowController.CancelAddNew method.


Similarly, you can also commit the new row programmatically using CommitAddNew method.



Sample Links:





2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment
Jan Herwig
May 04, 2018
Is there any way to commit/cancel within the "AddNewRowInitiating" Event?

I used the event to open a dialog where the user have to choose an item or cancel the complete add-procedure. Depending the result i want to commit/cancel the AddNewRow.


Please sign in to access our KB

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

Up arrow icon

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