How to use SfComboBox in SfDataForm editor

Hi,

I am using syncfusion data form control.

I can display the picker control fine in the editor using following code:


But i want to display the syncfusion combo box control instead of picker control.
Is there any way to do that? Please help me out on this.

3 Replies

JN Jayaleshwari N Syncfusion Team September 4, 2018 09:47 AM UTC

Hi Deepa,  
  
We have checked with your query for displaying the syncfusion combo box control instead of picker control in SfDataForm. Through registering custom view (SfComboBox) in custom editor your requirement can be achieved in sample level. You can refer our online user guide documentation for creating new custom editor n DataForm.  
  
  
Code snippet:  
  
dataForm.DataObject = new ContactInfo();
dataForm.RegisterEditor("ComboBox"new ComboBoxEditor(dataForm));
dataForm.RegisterEditor("ResolutionList""ComboBox");
 
 
public class ContactInfo
{
        public string SampleName
        {
            get;
            set;
        }
        private string resolutionList;
        public string ResolutionList
        {
            get { return resolutionList; }
            set { resolutionList = value; }
        }
}
 
 
 
public class ComboBoxEditor : DataFormEditor<SfComboBox>
{
        public ComboBoxEditor(SfDataForm dataForm):base(dataForm)
        {

        }
        protected override SfComboBox OnCreateEditorView()
        {
            return new SfComboBox();
        }
        protected override void OnInitializeView(DataFormItem dataFormItem, SfComboBox view)
        {
            base.OnInitializeView(dataFormItem, view);

            NSMutableArray resolutionList = new NSMutableArray();
            resolutionList.Add((NSString)" 1920 x 1080");
            resolutionList.Add((NSString)" 1680 x 1050");
            resolutionList.Add((NSString)" 1600 x 900");
            resolutionList.Add((NSString)" 1440 x 900");
            view.ComboBoxSource = resolutionList;

        }
 
} 
  
   
  
Sample:  DataFormSample_iOS
  
  
Please let us know whether provided solution meets your requirement.   
 
Regards, 
Jayaleshwari N. 



DE Deepa September 12, 2018 01:41 PM UTC

Hi,

Thanks for the reply. This worked great.


JM Jeyasri M Syncfusion Team September 14, 2018 04:00 AM UTC

Hi Deepa, 
 
We are glad to hear that provided solution works for you. Please let us know if you need any further assistance. 
 
Regards, 
Jeyasri M 


Loader.
Up arrow icon