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

Binding sfDataForm to a list

Hello,

I'm trying to bind the sfDataForm to a List.
The list contains only strings (List<string>()).
Now what I'd like to do is to change the editor for each element of that list, like Date or Time editor.
What I tried is to convert the value in the OnSet and convert it back in the OnGet method. That doesn't work and it gives me an exception.
I used the https://help.syncfusion.com/xamarin/sfdataform/working-with-dataform#manually-generate-dataformitems-for-data-dictionary example as a start.
How would I add a converter to each value?

Kind regards.

7 Replies

JN Jayaleshwari N Syncfusion Team February 26, 2019 01:15 PM UTC

Hi Cyril,  
  
Thanks for contacting Syncfusion Support.  
  
Based on the provided information, we have created a sample by manually generating dataform items such that for each dataform item editor can be set in the GenerateDataFormItems override method in SfDataForm Xamarin Forms and you can refer from the following location.  
 
Sample link: DemoSample
  
 
If this solution doesn’t meet your requirement, kindly modify the sample along with more explanation about your requirement. Such that it will be helpful for us to provide you possible solution.  
 
Regards, 
Jayaleshwari N. 



IM imc February 26, 2019 02:47 PM UTC

Hello and thank you very much for the sample.

Although that's how far I got. My problem now is, if I changed the Sample dictionary to be of type Dictionary<string, string>() I get an error as I have Time- or DateEditor defined. Because it can't cast from DateTime to string. 
What I would like now is that I can define an editor myself and 'bind' it to a string property. Thus, according to your page, I need an IValuePropertyConverter. How do I convert the value on the fly?




JN Jayaleshwari N Syncfusion Team February 27, 2019 11:33 AM UTC

Hi Cyril,  
  
Thank you for the update.  
Currently, we are analyzing your query, and we will update you further details about this on or before March 1, 2019. We appreciate your patience until then.  
  
Regards,  
Jayaleshwari N 



AS Arun siva Syncfusion Team March 1, 2019 02:47 PM UTC

Hi Cyril, 
 
Thank you for your patience. 
 
We have analyzed your requirement “Want to used dictionary<String,String>()” and you can achieve this in sample level, by customize the DataFormItemManager, we have prepared a simple sample for the same. 
 
Sample: SfDataForm. 
 
If the sample doesn’t meet your requirement, kindly revert us back by modifying the sample based on your scenario, which help us to analyze and resolve your requirement. 
 
Regards, 
Arun Siva R 



IM imc March 3, 2019 10:15 PM UTC

Hello,

thank you for your new example.

I tried it again (Win UWP) but got an error on editing the time. That's the same that happens to me.
Why can't I just use an IValuePropertyConverter? How would I add one without attribute?

Thanks and have a nice evening.


AS Arun siva Syncfusion Team March 4, 2019 12:52 PM UTC

Hi Cyril, 
 
Thank you for the update. 
 
Currently, we are analyzing your query about “Want to use dictionary<string,string>() with IValueConverter” and we will update you for this on two business days 6th March 2019. We appreciate your patience until then. 
 
Regards,
Arun Siva R 



AS Arun siva Syncfusion Team March 6, 2019 05:25 PM UTC

Hi Cyril, 
 
Thank you for the update. 
 
We have analyzed your query “Want to use Dictionay<String, String>” and you can achieve this in sample level, as we have mentioned in our previous update. As you mentioned we have faced crash in this scenario, and we already found fixed this issue. The issue fix will be included in our upcoming 2019 Volume 1 release which is expected to roll out at the mid of March 2019. We appreciate your patience. 
 
Kindly revert us if you have any concern. 
 
Regards, 
Arun Siva R 


Loader.
Live Chat Icon For mobile
Up arrow icon