Controls > Input > AutoComplete > Quick Start: Populating C1AutoComplete with data |
This section describes adding a C1AutoComplete control to your iOS application and populating it with data. The data is shown as a list in the drop-down part of the control.
Complete the following steps to display a C1AutoComplete control.
The following image shows a C1AutoComplete control displaying input suggestions as the user types.
To initialize C1AutoComplete control, open the ViewController file from the Solution Explorer and replace its content with the code below. This overrides the ViewDidLoad method of the View controller in order to initialize C1AutoComplete.
C# |
Copy Code |
---|---|
public override void ViewDidLoad() { base.ViewDidLoad(); HighlightDropdown.DropDownHeight = 200; HighlightDropdown.DisplayMemberPath = "Name"; HighlightDropdown.IsAnimated = true; HighlightDropdown.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 your application