Hi Alessandro,
You can validate the AddNewRow by handling RowValidating event of SfDataGrid. If you want to cancel the AddNew operation by validating, then you can use the below code to achieve your requirement,
using Syncfusion.UI.Xaml.Grid.Helpers;
this.dataGrid.RowValidating += dataGrid_RowValidating;
void dataGrid_RowValidating(object sender, RowValidatingEventArgs args)
{
if (this.dataGrid.IsAddNewIndex(args.RowIndex))
{
//Code for cancelling AddNew operation by validating the args.RowData
if (this.dataGrid.SelectionController.CurrentCellManager.CurrentCell.IsEditing)
this.dataGrid.SelectionController.CurrentCellManager.EndEdit(true);
var AddNewRowController = this.dataGrid.GetGridModel().AddNewRowController;
AddNewRowController.CancelAddNew();
}
}
Refer the below KB, if you are using below 13.3 version to reflect and cancel AddNew operation.
https://www.syncfusion.com/kb/5099/
Thanks,
Sivakumar