why AutoSuggestBox need click more than 1 time to choose item?

mc 3,866 Reputation points
2023-09-23T04:24:22.5533333+00:00

the AutoSuggestBox need click more than 1 time

when I set the itemsSource the suggest list disappeared and I click it there is nothing happened.

I need click another time to choose it.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
737 questions
{count} votes

Accepted answer
  1. Xiaopo Yang - MSFT 11,746 Reputation points Microsoft Vendor
    2023-09-25T03:22:32.86+00:00

    please try If you click the find icon you will set the itemsSource and then you tap a blank in the textbox there will show the list and you click one then there is nothing

    I can reproduce it.

    you click one then there is nothing

    I debugged and found that the click doesn't trigger the AutoSuggestBox.SuggestionChosen Event which could include a default function to set the AutoSuggestBox.Text.

    As a workaround indicated by the example, you can set it directly in AutoSuggestBox.QuerySubmitted for this condition.

            private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
            {
                //sender.SuggestionChosen += AutoSuggestBox_SuggestionChosen;
                if (args.ChosenSuggestion != null)
                {
                    sender.Text = args.ChosenSuggestion.ToString();
                }
            }
    

0 additional answers

Sort by: Most helpful