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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply converter to sfDataform by code

Thread ID:

Created:

Updated:

Platform:

Replies:

146294 Jul 30,2019 07:39 AM UTC Aug 1,2019 12:36 PM UTC Xamarin.Forms 3
loading
Tags: SfDataForm
Tung
Asked On July 30, 2019 07:39 AM UTC

Hello,
I need to use a converter in my editors. I found the instruction at https://help.syncfusion.com/xamarin/sfdataform/editing?cs-save-lang=1&cs-lang=csharp
It seems to meet my needs. How to apply the converter to the editor without declaring the property attribute?
Thank you

Subburaj Pandian Veluchamy [Syncfusion]
Replied On July 31, 2019 12:03 PM UTC

Hi Tung, 
  
Thank you for contacting Syncfusion support. 
  
We have analyzed your query “Apply converter to property from code in DataForm”, as of now, DataForm supports converters from the attribute. While creatingDataFormItems we are getting converter from respective property attributes. 
  
Kindly share more information on your requirement not to use the converter in property attribute. It will be helpful for us to analyze further and provide you a better solution. 
  
Regards,
Subburaj Pandian V     


Tung
Replied On August 1, 2019 01:13 AM UTC

Hello,

I cannot access the source code of the model because it is a third party *.dll.

Regards,

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 1, 2019 12:36 PM UTC

Hi Tung, 
  
Thank you for the update. 
  
As mentioned in our previous update Converter need to give in property attribute. Your requirement can be achieved using CustomEditor in DataForm. In custom editor OnCommit override method you can convert your value and set it to property. Kindly refer our UG documentation to know more about custom editor in DataForm, 
  
  
Code Snippet: 
[C#]        
protected override void OnCommitValue(Entry view) 
{ 
     var dataFormItemView = view.Parent as DataFormItemView; 
     var value = Convert.ToInt32(view.Text); 
     view.Text = (value * 10).ToString(); 
     this.DataForm.ItemManager.SetValue(dataFormItemView.DataFormItem, view.Text); 
} 
  
We have prepared a simple sample for the same, 
 
Sample link: DataForm 
  
We hope this helps. Kindly revert us if you have any concern. 
 
Regards,
Subburaj Pandian V  
 


CONFIRMATION

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