You can validate all the editors of Xamarin.Forms SfDataForm by using Validate method.
You can also refer the following article.
C#
You can validate all the properties using Validate inside the OnValidate command handler.
public DataFormViewModel()
{
loginInfo = new DataFormModel();
this.ValidateCommand = new Command<object>(this.OnValidate);
}
public Command<object> ValidateCommand { get; set; }
private void OnValidate(object dataForm)
{
var dataFormLayout = dataForm as Syncfusion.XForms.DataForm.SfDataForm;
dataFormLayout.Validate();
}
XMAL
ValidateCommand bind to Button form ViewModel
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.9*"/>
<RowDefinition Height="0.1*"/>
</Grid.RowDefinitions>
<dataForm:SfDataForm x:Name="dataForm" DataObject="{Binding LoginInfo}" Grid.Row="0" ValidationMode="LostFocus" CommitMode="LostFocus"/>
<Button x:Name="validateButton" Grid.Row="1" Text="Submit"
Command="{Binding Path=BindingContext.ValidateCommand,
Source={x:Reference Name=dataForm}}"
CommandParameter="{Binding Source={x:Reference Name=dataForm}}"/>
</Grid>
Output