SearchTextBox and inconsistent behaviour with SuggestSource

05-05-2022 04:08 AM
Occasional Contributor II

I have an ESRI control, SearchTextBox on my dockpane which I intend to show a suggested list of known authors in autocomplete dropdown that appears underneath the control - this is inbuilt functionality. You have to populate the SuggestionSource with an ObservableCollection of type objects.

In my case I am passing a list of strings (after the user types at least 2 letters). I assign my list of strings to ObservableCollection<object> AuthorList which is bound in XAML:


    x:Name="AuthorTextBox" SuggestionListMax="15"
    SuggestionSource="{Binding AuthorList}" ShowMagnifier="False" 
    InfoText="Author" SearchMode="Manual" 


As you can see this works to some extent (see below) - but it does not populate on every key press - it is very intermittent - even if you wait 1 minute! between each key press - sometimes nothing populates, then you can press delete and lose focus and click back, then add some letters and it populates, but it is very erratic in behaviour and this is very frustrating for me.


So I am typing "Jones" - and I debug and I can clearly see that the list has been cleared and it is about to accept 15 new entries,



however this seems to be ignored. When I go back to the application the control looks like this:




Here is my code on the text changed event - it is retrieving a list of 15 authors in sub second speed, it is very fast.

private async void AuthorTextBox_OnTextChanged(object sender, TextChangedEventArgs e)
	if (AuthorTextBox.Text.Length > 2)
			UriBuilder uriBuilder = new UriBuilder
				Scheme = "https",
				Host = "localhost",
				Path = "service/AuthorBasic/1",
				Port = 7269,
				Query = $"name={AuthorTextBox.Text}"

			var response = await CitationSearchVM.Client.GetAsync(uriBuilder.Uri);

			if (response.IsSuccessStatusCode == false)
				Log.Error("FAIL: " + response.StatusCode);
				string jsonText = await response.Content.ReadAsStringAsync();
				AuthorBasicResponse authorResponse = JsonConvert.DeserializeObject<AuthorBasicResponse>(jsonText);

		catch (Exception ex)

I don't know whether its some race condition or something I must be subtlety doing wrong.

If anyone can help it would be much appreciated.











Tags (2)
0 Kudos
0 Replies