This sample shows how to restrict decimal input in a Syncfusion .NET MAUI SfDataGrid numeric column so it accepts only whole numbers and completely blocks decimal input. Using this approach, users cannot type a decimal point and values remain integers while editing the numeric column.
You can achieve this by replacing the default numeric cell renderer and applying an integer-only edit mask to the underlying SfNumericEntry during edit mode. That means, set SfNumericEntry's CustomFormat as "$00000". So decimals are blocked at the input level in numeric cell. You can also keep the column's display format as "0" for consistent integer formatting.
public class CustomTextRenderer : DataGridNumericCellRenderer
{
public override void OnInitializeEditView(DataColumnBase dataColumn, SfNumericEntry view)
{
base.OnInitializeEditView(dataColumn, view);
if (view != null && view is SfNumericEntry entry)
{
var value = dataColumn.CellValue;
if (dataColumn != null && dataColumn.DataGridColumn != null && dataColumn.DataGridColumn.MappingName == "Qty")
{
entry.CustomFormat = "$00000";
}
}
}
}