Skip to content

feat(AutoSuggestBox): add ShowSuggestionsOnFocus property - #4077

Merged
Keboo merged 7 commits into
MaterialDesignInXAML:masterfrom
corvinsz:feat/AutoSuggestBox-ShowOnSuggestionsOnFocus
Jul 10, 2026
Merged

feat(AutoSuggestBox): add ShowSuggestionsOnFocus property#4077
Keboo merged 7 commits into
MaterialDesignInXAML:masterfrom
corvinsz:feat/AutoSuggestBox-ShowOnSuggestionsOnFocus

Conversation

@corvinsz

@corvinsz corvinsz commented Jul 4, 2026

Copy link
Copy Markdown
Member

Initially I just wanted to add a search dialog (blatantly stolen from mudblazor). While doing so, I noticed a few things with the AutoSuggestBox.

Demo app changes

Added a shortcut Ctrl+K to open a dialog so users can search and jump to pages using hotkeys.

MD2 app MD3 app
image image

AutoSuggestBox changes

  1. added a new DP ShowSuggestionsOnFocus
  2. override OnGotFocus method to open the suggestion listbox when ShowSuggestionsOnFocus="True"
  3. Removed the e.Handled="true" in the OnPreviewKeyDown. With this in place, consumers can't have custom actions on the AutoSuggestBox on the call-site. For example handling the Esc key to close the search-dialog (like I have done it in the demo apps).
    For some reason I can't reproduce the bug that e.Handled="true" was supposed to fix.
  4. Some refactoring and performance improvement (GetItemCount())
  5. Added Placement="Bottom" and PlacementTarget="{Binding ElementName=OuterBorder}" to the PopupEx, because without it the popup wouldn't update it's position when moving the window:
image
  1. With StaysOpen="False" the list wasn't reliably opened, so I changed it to true (e.g. open search dialog -> move window -> focus the AutoSuggestBox again and see that the list wouldn't open again)
  2. Added tests to validate the new behavior

@corvinsz
corvinsz marked this pull request as ready for review July 8, 2026 15:56
- Simplified LINQ expression in AutoSuggestBox
- Modernized collection creation in QuickSearchDialogViewModel
- Added design-time DataContext to QuickSearchDialog
@Keboo
Keboo enabled auto-merge (squash) July 10, 2026 05:21
@Keboo Keboo added enhancement demo app Items that relate to the demo application release notes Items are likely to be highlighted in the release notes. labels Jul 10, 2026
@Keboo Keboo added this to the 5.3.3 milestone Jul 10, 2026
@Keboo
Keboo merged commit ef3a5ea into MaterialDesignInXAML:master Jul 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

demo app Items that relate to the demo application enhancement release notes Items are likely to be highlighted in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants