Search code examples
c#wpfautocompletebox

Get Count of Items in WPF Toolkit AutoCompleteBox Dropdown


Is there a way to get the count of the items currently showing in the dropdown in a WPF toolkit autocompletebox?


Solution

  • Handle the Populated event:

    private void AutoCompleteBox_Populated(object sender, PopulatedEventArgs e)
    {
        int count = 0;
        foreach (var item in e.Data)
            count++;
    
        string text = count + " items shown!";
    }