.NET MAUI DataForm Validation
.NET MAUI DataForm provides built-in validation, which gives you full control over the data collected through the control.

The next sections list all DataForm members related to validation.
Validation Modes
The selected mode is applied through ValidationMode (of typeTelerik.Maui.Controls.DataFormValidationMode) property of the DataForm control. You can choose between three validation modes:
Explicit—The changes are validated explicitly by invoking theValidateCommandor calling theValidateChangesmethod of the DataForm.LostFocus—The changes are validated after the editor loses focus.PropertyChanged—The changes in the editor are validated immediately on each property change (when the property value changes).
When
ValidationModeisLostFocus, you have to setCommitModetoLostFocusorExplicit.
The ValidationMode must be applied globally to the RadDataForm:
<telerik:RadDataForm x:Name="dataForm"
ValidationMode="LostFocus"/>
Validation Properties
HasValidationErrors(bool)—Gets a value indicating whether it has validation errors.
Events
DataForm exposes the following events for validation:
-
ValidationCompleted—Raised when the DataForm validation completes. TheValidationCompletedevent handler receives two parameters:senderargument which is of type object, but can be cast to theRadDataFormtype.DataFormObjectValidationCompletedEventArgswhich provides additional information for the validatedDataObject, theValidationErros(IReadOnlyListofDataFormValidationError) and whether it has validation errorsHasValidationErrors(bool).
-
EditorValidationCompleted—Raised when the validation of an editor has completed. TheEditorValidationCompletedevent handler receives two parameters:senderargument which is of type object, but can be cast to theRadDataFormtype.DataFormEditorValidationCompletedEventArgswhich provides additional information for the validatedPropertyName, the original value ff the validated propertyPropertyValue(object) in the model and the modified value of the validated property in the editor -EditorValue(object).
Manual Validation with Methods
DataForm exposes a ValidateChanges method with two overloads:
ValidateChanges()—Executes the validation logic associated with the DataForm control. This method is useful when theValidationModeisExplicit. The method returnstrueif the validation passes, otherwisefalse.
this.dataForm.ValidateChanges();
ValidateChanges(string propertyName)