Skip to content

This repository contains a sample on How to save or cancel the edited data in the Syncfusion Xamarin.Forms Dataform (SfDataform)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/save-or-cancel-dataform-data-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

How to save or cancel the edited DataForm data in Xamarin.Forms (SfDataForm) ?

You can save or cancel the DataObject in Xamarin.Forms SfDataForm by storing the dataobject.

You can refer the following article.

https://www.syncfusion.com/kb/11312/how-to-save-or-cancel-the-edited-dataform-data-in-xamarin-forms-sfdataform

C#

Raise the property change event to store the DataObject.

private void DataForm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
    if(e.PropertyName == "DataObject")
    formModel = dataForm.DataObject as DataFormModel;
}

C#

Cancel will reset the DataObject with stored dataobject.

private void OnCancel(object sender, EventArgs e)
{
    dataForm.DataObject = formModel;
    foreach (var property in dataForm.DataObject.GetType().GetProperties())
    {
        dataForm.UpdateEditor(property.Name);
    }
}

C#

Saves the edited data by using Commit method.

private void OnSaved(object sender, EventArgs e)
{
    dataForm.Validate();
    dataForm.Commit();
    formModel = dataForm.DataObject as DataFormModel;
}

About

This repository contains a sample on How to save or cancel the edited data in the Syncfusion Xamarin.Forms Dataform (SfDataform)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages