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.
Add a new class to the application that serves as the data source for C1AutoComplete.
C# |
Copy Code
|
---|---|
class Countries : NSObject { [Export("Name")] public string Name { get; set; } public Countries() { this.Name = string.Empty; } public Countries(string name) { this.Name = name; } public static IEnumerable<object> GetDemoDataList() { List<object> array = new List<object>(); 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..."; } |
Press F5 to run the application.