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

Nullable Enums

In my SfDataForms, if I use an Enum to fill a field, it works as expected, showing a Combo where I can select any valid value of my Enum, but sadly it's initially rendered with a value. But if I use a nullable enum, the field is initially rendered empty, but the combobox is not shown, a generic text input box is shown.

How can I have a Enum with combobox but starting with empty value?

1 Reply

JN Jayaleshwari N Syncfusion Team February 20, 2019 12:25 PM UTC

Hi Anibal,  
We have checked your query for having Enum type with combobox and starting with empty value in SfDataForm Xamarin Forms. In DataForm, if enum type is binded, the first value in the enum will be displayed in the view in combobox. However, your requirement can be achieved by using CustomEditor with DataFormDropDownEditor. In the sample, enum type is passed as collection of string and empty string is set as initial value such that combobox will be starting with empty value. We have prepared the sample for the same. Kindly find the sample below.  
Sample: ComboBoxEditor
You can refer our online user guide documentation to know more about using ComboBox in SfDataForm  
Please let us know whether the provided solution satisfies your requirement. If not, kindly revert us back with more details related to your requirement by modifying the provided sample with screenshots (if possible). It will be helpful for us to provide you possible solution. 
Jayaleshwari N. 

Live Chat Icon For mobile
Up arrow icon