Populate a DataForm from JSON

I want to Populate a DataFrom with values by default. 


Model:
using System;
using System.Collections.Generic;
using System.Text;

namespace BottomBarDemo.Model
{
    public class ViewWorkItemDataForm
    {
        private string title;
        private string state;
        private string assignedTo;
        private string description;
        private string acceptanceCriteria;
        private string area;
        private string iteration;
        private string effort;

        public ViewWorkItemDataForm()
        {
            
        }
 
        public string Title
        {
            get { return title; }
            set { this.title = value; }
        }
        public string State
        {
            get { return state; }
            set { this.state = value; }
        }
        public string AssignedTo
        {
            get { return assignedTo; }
            set { this.assignedTo = value; }
        }
        public string Description
        {
            get { return description; }
            set { this.description = value; }
        }
        public string AcceptanceCriteria
        {
            get { return acceptanceCriteria ; }
            set { this.acceptanceCriteria = value; }
        }
        public string Area
        {
            get { return area; }
            set { this.area = value; }
        }
        public string Iteration
        {
            get { return iteration; }
            set { this.iteration = value; }
        }
        public string Effort
        {
            get { return effort; }
            set { this.effort = value; }
        }

    }
}

View:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:dataForm="clr-namespace:Syncfusion.XForms.DataForm;assembly=Syncfusion.SfDataForm.XForms"
             xmlns:local="clr-namespace:BottomBarDemo.Behavior"
             mc:Ignorable="d"
             x:Class="BottomBarDemo.EpicDetailsPage">
    <ContentPage.Behaviors>
        <local:DataFormBehaviorDetails />
    </ContentPage.Behaviors>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="*" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0"
              x:Name="TitleGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="1">
                <Label x:Name="title"
                       Text="Epic Details"
                       TextColor="White"
                       FontSize="Large"
                       VerticalTextAlignment="Center"
                       HorizontalTextAlignment="Center"
                       VerticalOptions="Center"
                       HorizontalOptions="Center"></Label>
            </Grid>

            <Grid Grid.Row="2">
                <Label x:Name="project"
                       Text="digital-cells-sso-dna"
                       TextColor="White"
                       FontSize="Small"
                       VerticalTextAlignment="Start"
                       HorizontalTextAlignment="Center"
                       VerticalOptions="Start"
                       HorizontalOptions="Center"></Label>
            </Grid>
        </Grid>
        <Grid Grid.Row="1"
              Padding="10,2,0,0">
            <dataForm:SfDataForm x:Name="dataForm"
                                 LayoutOptions="TextInputLayout"
                                 ColumnCount="2" />
        </Grid>
        <Grid Grid.Row="2">
            <Button  x:Name="CreateChildFeature"
                     Text="Create Feature"
                     Clicked="CreateChildFeature_Clicked" />
        </Grid>
    </Grid>
</ContentPage>

The json data is obtained on a previous view and is stored in App.xaml.cs

I am very confused how to I access the Data Form 




10 Replies

MS Muniappan Subramanian Syncfusion Team March 23, 2020 12:24 PM UTC

Hi Emad Afag 
 
Thank you for contacting Syncfusion support. 
 
Currently, we are analyzing your requirement “Populate a DataForm from JSON”. We will validate and update you the further details in two business days (March 25, 2020). We appreciate your patience until then. 
 
Regards, 
Muniappan S. 



MS Muniappan Subramanian Syncfusion Team March 25, 2020 11:48 AM UTC

Hi Emad Afag, 
 
Thank you for your patience. 
 
We have checked your requirement of “Populate a DataForm from JSON data”. We would like to inform you that you can load JSON data to SfDataForm, we have prepared a sample for the same, please find the sample by the following link.  
 
  
We hope this helps. Please let if you if you have any concern.  
 
Regards, 
Muniappan S. 



EA Emad Afaq March 26, 2020 09:21 AM UTC

I checked the sample. In your sample you are directly adding a JSON to the Model. what I have is a variable which has stored a deserialized value from a different model.

so basically the variable has a different structure and my model which i am using for Dataform is different. So can you help me understand in this case how I will achieve that.


MS Muniappan Subramanian Syncfusion Team March 27, 2020 08:40 AM UTC

Hi Emag Afag, 
 
Thanks for the update. 
 
Based on the shared information we have checked your query “How to bind JSON data to SfDataForm” and we have achieved your requirement and modified the sample for the same, please find the sample from below link, 
 
  
We hope that this helps you, kindly revert us if you have any concern.   
 
Regards, 
Muniappan S. 



EA Emad Afaq March 29, 2020 08:52 AM UTC

I cant download. It says access denied. let me know. Thanks


MS Muniappan Subramanian Syncfusion Team March 30, 2020 05:12 AM UTC

Hi Emad Afag, 
 
Sorry for the Inconvenience caused. 
 
Please find the sample from below link, 
 
 
kindly revert us if you have any concern. 
 
Regards, 
Muniappan S. 



EA Emad Afaq March 30, 2020 08:41 AM UTC

Hi,

I can only access the first sample. Even the new one says access denied. 


MS Muniappan Subramanian Syncfusion Team March 31, 2020 05:36 AM UTC

Hi Emad Afag, 
 
Sorry for the Inconvenience caused. 
 
Please find the sample from below link, 
 
  
kindly revert us if you have any concern. 
 
Regards, 
Muniappan S. 



EA Emad Afaq April 3, 2020 06:53 AM UTC

Thank you for the support


MS Muniappan Subramanian Syncfusion Team April 6, 2020 06:03 AM UTC

Hi Emad Afag, 
 
Thank you for the update. 
 
We are glad that our solution meets your requirement. Please let us know if you need any further update. As always, we are happy to help you out. 
 
Regards, 
Muniappan S. 


Loader.
Up arrow icon