Populating listbox as I type

Eduardo Gomez 3,416 Reputation points


I am tryng to suggest places to my user as they type to a textbox.
I already declared a Listox in order to show the results, but I do not know how to call the api as the user type, and show the listbox with places.

App https://github.com/eduardoagr/RsidentsManager

For example: like how Bingsugget places as you type

By thhe way I am using Bing Api to do this and MVVM


materialDesign:HintAssist.IsFloating="True" />

        <ListBox Visibility='Collapsed' />  

Services - Api Method

public static async Task<List<string>> CallApi(string query) {

        using (var client = new HttpClient()) {  

            var list = new List<string>();  

            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);  

            var content = await client.GetAsync(requestUri: $"{baseUri}?{QUERY_PARAMETER}{query}{MKT_PARAMETER}");  

            if (content.IsSuccessStatusCode) {  

                string jsonContent = await content.Content.ReadAsStringAsync();  
                SearchSuggestion response = JsonConvert.DeserializeObject<SearchSuggestion>(jsonContent);  
                if (response.Query != null) {  

            return list;  

public class PrpertiesWindowViewModel : BaseViewModel {

    public List<int> Rooms { get; set; }  

    public PrpertiesWindowViewModel() {  

        Rooms = new List<int>();  


    private void FillList() {  

        for (int i = 1; i < 5000; i++) {  


Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,689 questions
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
772 questions
{count} vote

Accepted answer
  1. Hui Liu-MSFT 44,186 Reputation points Microsoft Vendor

    Hi,@Eduardo Gomez . Welcome Microsoft Q&A.
    If you want to get suggestions as you type via Github from your post, you could check out the code here.

    The result:

    If the response is helpful, please click "Accept Answer" and upvote it.
     Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread. 

    [5]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html

0 additional answers

Sort by: Most helpful