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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I set data into the editors?

Thread ID:





147222 Sep 4,2019 09:57 AM UTC Sep 5,2019 12:05 PM UTC Xamarin.Forms 1
Tags: SfDataForm
Asked On September 4, 2019 09:57 AM UTC


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"/>

Karthikraja Arumugam [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon