We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I set data into the editors?


I was wondering how I can set data into the editors when the from is not autogenerated.
And also how to perfom the validation.

Here is a example how I build the xaml.

With kind regards,


    <dataForm:SfDataForm x:Name="dataForm"
                         DataObject="{Binding Opdracht}">
<dataForm:DataFormTextItem Name="Name" Editor="Text"/>
<dataForm:DataFormTextItem Name="Password" Editor="Password"/>
<dataForm:DataFormMaskedEditTextItem Name="Phone" Editor="MaskedEditText"/>
<dataForm:DataFormTextItem Name="Address" Editor="MultilineText"/>
<dataForm:DataFormDateItem Name="BirthTime" Editor="Date"/>

1 Reply

KA Karthikraja Arumugam Syncfusion Team September 5, 2019 12:05 PM UTC

Thank you for contacting Syncfusion support. 
Query 1: Regarding validation while AutoGeneration set to false 
As per SfDataForm implementation, if we set AutoGeneration to false, DataFormItems will generate from XAML page but it will capture the details of curresponding property from the data model. So if you set validation attributes to the property then validation will perform as default 
Please refer the following code example for the same, 
[Required(AllowEmptyStrings = false, ErrorMessage = "Name should not be empty")] 
 public String Name { get; set; } 
 [StringLength(16,MinimumLength =8 , ErrorMessage = "Password should have 8-16 characters")] 
  public String Password { get; set; } 
Kindly refer our UG documentation to know more about validation in DataForm, 
Query 2: Regarding editors with values on initial loading while AutoGeneration set to false 
As we have mentioned, DataFormItem will generate with respective property information so if you set value for the property DatForm editors will have the value on initial loading. 
Please refer the following code example for the same, 
public ContactInfo() 
            contactDetails = new Contacts(); 
            contactDetails.Name = "Jhon"; 
We have prepared a sample based on your requirement, please find the sample by the following link. 

Sample link:
In the sample, as per your requirement we have set validation attributes for validation and set values for properties on initial loading. 
We hope this helps. Please let us know, if you need any further assistance. 
Karthik Raja A

Live Chat Icon For mobile
Up arrow icon