Controls > Input > ComboBox > Quick Start: Display a C1ComboBox Control |
This section describes adding a C1ComboBox control to your iOS application and displaying a list of items in the drop-down as input suggestions for users.
Complete the following steps to display a C1ComboBox control.
The following image shows a C1ComboBox displaying input suggestions as the user types.
Complete the following steps to add a list of items to be displayed in the drop-down list.
C# |
Copy Code |
---|---|
public static IEnumerable<object> GetDemoDataList() { List<object> array = new List<object>(); //NSMutableArray array = new NSMutableArray(); var quarterNames = "Australia,Bangladesh,Brazil,Canada,China".Split(','); for (int i = 0; i < quarterNames.Length; i++) { array.Add(new Countries { Name = quarterNames[i] }); } return array as IEnumerable<object>; } |
C# |
Copy Code |
---|---|
public override void ViewDidLoad() { base.ViewDidLoad(); ComboBoxEdit.DisplayMemberPath = "Name"; ComboBoxEdit.ItemsSource = Countries.GetDemoDataList(); ComboBoxEdit.DropDownHeight = 200; ComboBoxEdit.Placeholder = "Please Enter..."; ComboBoxEdit.ItemsSource = GetDemoDataList(); } public static IEnumerable<object> GetDemoDataList() { List<object> array = new List<object>(); //NSMutableArray array = new NSMutableArray(); var quarterNames = "Australia,Bangladesh,Brazil,Canada,China".Split(','); for (int i = 0; i < quarterNames.Length; i++) { array.Add(new Countries { Name = quarterNames[i] }); } return array as IEnumerable<object>; } |
Press F5 to run the application.