Databind with Enum Property

I have a Model with an integer property: IntegratorType, valid values are 0 and 1 for Old and New style integrator.

I added a enum IntegratorTypes with Old and New.:

    public enum IntegratorTypes
    {
        [Description("Old")]
        Old = 0,
        [Description("New")]
        New = 1,
    };


Then a property for the field:

       [Display(Prompt = "Integrator Type", Name ="Integrator Type")]
        public IntegratorTypes IntegratorType
        {
            get => integratorTypeSelect;
            set
            {
                integratorTypeSelect = value;
                RaisePropertyChanged("IntegratorTypeSelect");
            }
        }

When I receive the data from the server, the properties are filled with right values, anyway as soon as I open a new Page with a SfDataForm on it and I bind the object to the form, it automatically changes the value of the field to Old. 





4 Replies

SV Srinivasan Vasu Syncfusion Team May 8, 2018 11:27 AM UTC

Hi Gabriel, 
Thanks for contacting Syncfusion support. 
 
 
We have checked your query. Could you please confirm whether the “PickerItem selected value (New) replaced with First Item(Old) in the Collection of Enum type” in SfDataForm? 
  
It will helpful to provide appropriate solution. 
  
Regards, 
Srinivasan 



GA Gabriel Armendariz Villarreal May 8, 2018 01:59 PM UTC

Hello, thanks for your response.

I'm not sure what you want me to check. The element in the SfDataForm is a Picker loaded with right values, anyway it is always loaded with Old value selected, and as it is a TwoWay binding it changes the value of my Model to Old. It just like if the  Element Picked event it is being raised when the collection is loaded and changes my value. It doesn't matter which element I assign value of Zero, it gets picked.

Any ideas?

Gabriel


SV Srinivasan Vasu Syncfusion Team May 11, 2018 05:46 AM UTC

Hi Gabriel, 
 
We have already logged a task report for this “Enum type has been reset with first item in the ItemsSource of DataFormPickerItem” issue in SfDataForm. We will fix and it will be available in our upcoming Vol2 2018 release at the end of May 2018. 
 
We appreciate your patience until then. 
 
Regards, 
Srinivasan 



JM Jeyasri M Syncfusion Team June 25, 2018 12:05 PM UTC

Hi Gabriel 
 
We are glad to announce that our Essential Studio Volume 2, 2018 (Version 16.2.0.41) is rolled out, the fix for the issue with Enum type has been reset with first item in the ItemsSource of DataFormPickerItem has been included and is available for download under the following link. 
 
                  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Jeyasri M 


Loader.
Up arrow icon