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 to render DataForm using FSharp application in Xamarin.Forms?

Platform: Xamarin.Forms |
Control: SfDataForm
Tags: dataform, fsharp

This article explains how to render DataForm using FSharp application in Xamarin.Forms.


Define the properties in the model class.


   type ContactForm() =     
    member val Name = "John" with get,set
    member val Age= "20" with get,set
    member val Address = "" with get,set
    member val Email = "" with get,set 


In the main page, load the DataForm content in the FSharp project.


    type DataFormFSharp() = 
    inherit ContentPage()
    let _ = base.LoadFromXaml(typeof<DataFormFSharp>)    
    let dataForm = base.FindByName<SfDataForm>("dataForm")       
    type App() = 
    inherit Application(MainPage = DataFormFSharp()) 


Bind the view model to the ContentPage, and include DataForm inside a StackLayout. This is a function that takes the model and returns a UI based on the model.


        <StackLayout Orientation="Vertical"
            <dataForm:SfDataForm x:Name="dataForm"
                             VerticalOptions ="FillAndExpand"
                              DataObject="{Binding ContactInformation}"


Set the ContactForm model class in the view model class of the application.


type ViewModel() =     

    member val ContactInformation = ContactForm() with get, set


Sample Demo: DataFormFSharp

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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