protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_autocomplete); // Highlight sample XuniAutoCompleteTextView highLightAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_highlight); //highLightAutoComplete.SetItemsSource(DropDownItem.country); highLightAutoComplete.DisplayMemberPath = "Name"; highLightAutoComplete.ItemsSource = DropDownItem.getList(); highLightAutoComplete.MatchType = MatchType.Contains; highLightAutoComplete.Threshold = 1; // Delay sample XuniAutoCompleteTextView delayAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_delay); delayAutoComplete.DisplayMemberPath = "Name"; delayAutoComplete.ItemsSource = DropDownItem.getList(); delayAutoComplete.MatchType = MatchType.Contains; delayAutoComplete.Threshold = 1; delayAutoComplete.Delay = 1500; // Delay 1500 milliseconds. delayAutoComplete.SetWidth(20); // Custom sample System.Collections.Generic.IDictionary <Integer, string> viewToDataMap = new JavaDictionary <Integer, string>(); viewToDataMap.Add(Integer.ValueOf(Resource.Id.imageView1), "flag"); viewToDataMap.Add(Integer.ValueOf(Resource.Id.textView1), "Name"); XuniAutoCompleteTextView customAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_custom); customAutoComplete.SetDropDownItemLayoutId(Resource.Layout.custom_item); // Custom drop down item. customAutoComplete.SetDropDownItemTextViewId(Resource.Id.textView1); customAutoComplete.ViewDataBinderMap = viewToDataMap; IList <object> list = DropDownItem.getList(); customAutoComplete.ItemsSource = list; customAutoComplete.DisplayMemberPath = "Name"; customAutoComplete.MatchType = MatchType.Contains; customAutoComplete.Threshold = 1; // custom filter sample filterAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_filter); filterAutoComplete.ItemsSource = DropDownItem.getList(); filterAutoComplete.DisplayMemberPath = "Name"; filterAutoComplete.Threshold = 1; filterAutoComplete.FilteringEvent += filterAutoComplete_FilteringEvent; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_autocomplete); // Highlight sample XuniAutoCompleteTextView highLightAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_highlight); //highLightAutoComplete.SetItemsSource(DropDownItem.country); highLightAutoComplete.DisplayMemberPath = "Name"; highLightAutoComplete.ItemsSource = DropDownItem.getList(); highLightAutoComplete.MatchType =MatchType.Contains; highLightAutoComplete.Threshold=1; // Delay sample XuniAutoCompleteTextView delayAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_delay); delayAutoComplete.DisplayMemberPath = "Name"; delayAutoComplete.ItemsSource=DropDownItem.getList(); delayAutoComplete.MatchType = MatchType.Contains; delayAutoComplete.Threshold = 1; delayAutoComplete.Delay = 1500; // Delay 1500 milliseconds. delayAutoComplete.SetWidth(20); // Custom sample System.Collections.Generic.IDictionary<Integer, string> viewToDataMap = new JavaDictionary<Integer, string>(); viewToDataMap.Add(Integer.ValueOf(Resource.Id.imageView1), "flag"); viewToDataMap.Add(Integer.ValueOf(Resource.Id.textView1), "Name"); XuniAutoCompleteTextView customAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_custom); customAutoComplete.SetDropDownItemLayoutId(Resource.Layout.custom_item); // Custom drop down item. customAutoComplete.SetDropDownItemTextViewId(Resource.Id.textView1); customAutoComplete.ViewDataBinderMap = viewToDataMap; IList<object> list = DropDownItem.getList(); customAutoComplete.ItemsSource = list; customAutoComplete.DisplayMemberPath = "Name"; customAutoComplete.MatchType = MatchType.Contains; customAutoComplete.Threshold = 1; // custom filter sample filterAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_filter); filterAutoComplete.ItemsSource = DropDownItem.getList(); filterAutoComplete.DisplayMemberPath = "Name"; filterAutoComplete.Threshold=1; filterAutoComplete.FilteringEvent += filterAutoComplete_FilteringEvent; }