Getting Started

This example will guide you through the steps needed to add a basic RadDataForm control in your application.

Before you proceed, please, take a look at these articles and follow the instructions to setup your app:

Example

If your app is setup, you are ready to add a RadDataForm control.

Here is a sample class that will be the view model of the data form:

public class SourceItem : NotifyPropertyChangedBase
{
    string name = "Anna";
    double weight = 60.5;
    int height = 163;
    int age = 27;

    [DisplayOptions(Header = "Name")]
    public string Name
    {
        get { return this.name; }
        set
        {
            if (value != this.name)
            {
                this.name = value;
                OnPropertyChanged();
            }
        }
    }

    [DisplayOptions(Header = "Age")]
    public int Age
    {
        get { return this.age; }
        set
        {
            if (value != this.age)
            {
                this.age = value;
                OnPropertyChanged();
            }
        }
    }

    [DisplayOptions(Header = "Weight (kg)")]
    public double Weight
    {
        get { return this.weight; }
        set
        {
            if (value != this.weight)
            {
                this.weight = value;
                OnPropertyChanged();
            }
        }
    }

    [DisplayOptions(Header = "Height (cm)")]
    public int Height
    {
        get { return this.height; }
        set
        {
            if (value != this.height)
            {
                this.height = value;
                OnPropertyChanged();
            }
        }
    }
}

Here is the setup of the data form:

<telerikInput:RadDataForm x:Name="dataForm">
    <telerikInput:RadDataForm.Source>
        <local:SourceItem />
    </telerikInput:RadDataForm.Source>
</telerikInput:RadDataForm>
var dataForm = new RadDataForm
{
    Source = new SourceItem()
};

You also need to add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
using Telerik.XamarinForms.Input;

After that you have to specify the editor types:

dataForm.RegisterEditor(nameof(SourceItem.Age), EditorType.IntegerEditor);
dataForm.RegisterEditor(nameof(SourceItem.Name), EditorType.TextEditor);
dataForm.RegisterEditor(nameof(SourceItem.Weight), EditorType.DecimalEditor);
dataForm.RegisterEditor(nameof(SourceItem.Height), EditorType.IntegerEditor);

SDK Browser and QSF applications contain different examples that show RadDataForm's main features. You can find the applications in the Examples and QSF folders of your local Telerik UI for Xamarin installation.

See Also