Thanks for contacting Syncfusion Support.
We have checked the reported query “Change Error Color ” from our side. You can customize the valid and invalid message in Validation view by using ValidationTemplate of SfDataForm, you can use custom view with desired color for valid and invalid message in Validation view.
Code snippet XAML: Validation template defined and bound to ValidationTemplate property
<ContentPage.Resources>
<ResourceDictionary>
<local:TemplateSelector x:Key="validationDataTemplateSelector" />
</ResourceDictionary>
</ContentPage.Resources>
<dataForm:SfDataForm Grid.Row="1" x:Name="dataForm" ValidationTemplate="{StaticResourcevalidationDataTemplateSelector}" /> |
Code snippet C#: ValidationTemplateSelector definition.
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
{
var dataFormItem = item as DataFormItem;
if (dataFormItem.LabelText == "First Name")
{
if (!dataFormItem.IsValid)
{
return InValidMessageTemplate;
}
else
{
return ValidMessageTemplate;
}
}
else if (dataFormItem.LabelText == "Last Name")
{
if (!dataFormItem.IsValid)
{
return LastNameTemplate;
}
}
else if (dataFormItem.LabelText == "Email")
{
if (!dataFormItem.IsValid)
{
return EmailTemplate;
}
}
else if (dataFormItem.LabelText == "Contact Number")
{
if (!dataFormItem.IsValid)
{
return ContactNumberTemplate;
}
}
return null;
} |
We have attached the sample for your reference and you can download the same from the following location.
Note: We have included this ValidationTemplate support in our 2018 Vol 4 main release (v16.4.0.44), please update to our latest version.
Please let us know if you would require further assistance.
Regards,
Jayaleshwari N.