void dataForm_ValidateProperty(System.Object sender, DataFormPropertyValidationEventArgs e) { if (e.PropertyName == "Password") { if (e.NewValue.ToString().Length < 6) { e.HasError = true; e.ErrorText = "The password should contain more than 5 characters."; } } }
void DataFormOnValidateProperty(object sender, DataFormPropertyValidationEventArgs e) { if (e.PropertyName == nameof(DeliveryInfo.DeliveryTimeFrom)) { ((DeliveryInfo)dataForm.DataObject).DeliveryTimeFrom = (DateTime)e.NewValue; Device.BeginInvokeOnMainThread(() => { dataForm.Validate(nameof(DeliveryInfo.DeliveryTimeTo)); }); } if (e.PropertyName == nameof(DeliveryInfo.DeliveryTimeTo)) { DateTime timeFrom = ((DeliveryInfo)dataForm.DataObject).DeliveryTimeFrom; if (timeFrom > (DateTime)e.NewValue) { e.HasError = true; e.ErrorText = "The end time cannot be less than the start time"; return; } } }