Articles in this section
Category / Section

How to Commit the AddNewRow value without pressing Enter key in WinRT DataGrid?

1 min read

In the SfDataGrid, you can programmatically force addnewrow to commit the changes by calling the method, EndEdit of CurrentCellManager and CommitAddNew of AddNewRowController.

 

C#:

 
private void CommitAddNewRow(object sender, RoutedEventArgs e)
{
    if (this.sfDataGrid.View != null && this.sfDataGrid.View.IsAddingNew)
    {
        // it commit the entered value in the grid.
        if (this.sfDataGrid.SelectionController.CurrentCellManager.CurrentCell.IsEditing)
            this.sfDataGrid.SelectionController.CurrentCellManager.EndEdit(true);
        var addNewRowController = this.sfDataGrid.GetAddNewRowController();
        addNewRowController.CommitAddNew();
    }
}
 

 

Sample Links:

 

WPF

 

WinRT

 

UWP

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied