Reputation: 855
I am implementing an autocomplete view in my mobile app that i am developing using Xamarin.
I have set threshold to 1 and set the focus to autocomplete view in onCreate event of activity.
autoCompleteView.FocusChange += delegate(object sender, View.FocusChangeEventArgs args)
{
if (args.HasFocus)
{
autoCompleteView.ShowDropDown();
}
};
It displays the dropdown with all the suggestions when my app is loaded. Whenever i type text, it filters based on condition and everything is working fine. But when i clear all the text in the autocomplete view, the dropdown is closed. But i want to display the dropdown with all the suggestions.
Also whenever i touch/click the autocomplete view, the dropdown is closed. So i have added the below code to display the dropdown, but there is a flicker(dropdown is closed and is opened again).
autoCompleteView.Click += delegate(object sender, EventArgs args) {
autoCompleteView.ShowDropDown ();
};
Thanks in advance.
Upvotes: 1
Views: 1198
Reputation: 6201
It displays the dropdown with all the suggestions when my app is loaded
autoCompleteView.ShowDropDown();
in you OnCreate
(independant of focus), this way the app loads with the dropdown showing.Also whenever i touch/click the autocomplete view, the dropdown is closed. So i have added the below code to display the dropdown, but there is a flicker(dropdown is closed and is opened again).
TextChanged
event and call autoCompleteView.ShowDropDown();
whenever the text in the EditText
is String.Empty
.Upvotes: 1