how to show the suggest when I click the autosuggest (focused?)

mc 5,426 Reputation points
2023-09-20T14:36:23.0233333+00:00

I have to place blank space key to show the suggest

Windows development Windows App SDK
0 comments No comments
{count} votes

Accepted answer
  1. Xiaopo Yang - MSFT 12,731 Reputation points Microsoft External Staff
    2023-09-21T04:25:06.7866667+00:00

    Because AutoSuggestBox is sealed, you need to implement your AutoSuggestBox based on microsoft-ui-xaml/dev/AutoSuggestBox.

    According to microsoft-ui-xaml/dev/AutoSuggestBox /AutoSuggestBox_themeresources_v1.xaml, my workaround looks like:

            protected override void OnApplyTemplate()
            {
                base.OnApplyTemplate();
                popup = this.GetTemplateChild("SuggestionsPopup") as Popup;
                this.GotFocus += (sender, e) => {
                    var s = sender as YourAutoSuggestBox;
                    s.popup.IsOpen = true;
                };
            }
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.